I cant send mails with the function mail()

Status
Not open for further replies.

medina

x10 Addict
Community Support
Messages
1,811
Reaction score
7
Points
38
Hi, im a old user in the Spanish Forum :), i have this problem:

I have a contact form in my web, but when i send me a mail with this contact form, i receive this whith all values in blank. This is not a Script error because i try with all Contact script and is the same problem

Sorry for my bad leanguege!!...
 

medina

x10 Addict
Community Support
Messages
1,811
Reaction score
7
Points
38
I want to know if this problem is for ALL the users in lotus server or only is my account the problem, if the someone had the same problem please tell me how fixed....
 

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
Do you want to hear the truth or do you want to hear that problem will be resolved soon?

This answer is not helpful at all, if I see more like this you will be banned from this forum.

Hi, im a old user in the Spanish Forum , i have this problem:

I have a contact form in my web, but when i send me a mail with this contact form, i receive this whith all values in blank. This is not a Script error because i try with all Contact script and is the same problem

Sorry for my bad leanguege!!...

It's probably best that you paste the code here you're using. If you're receiving mail it does not seem like a server issue.
 

medina

x10 Addict
Community Support
Messages
1,811
Reaction score
7
Points
38
Ok I show you the code:

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>

<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="formulario1.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
and...
<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";

// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";

// Enter your email address
$to ='alejandro@tudisenas.com';

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>
This is the script that in the moment i use

And this he is the one that before used
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail( "alejandro@tudisenas.com", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='?id=co'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
And i have the same with the 2 scripts, but if i try to send me a mail directly with this code
mail(alejandro@tudisenas.com,exameple,explamle2,example3);

I recieve the mail with this values, i think that the problem this in a species of filter that does not leave passes the values of the contact form to the part that is processed and the mail sent
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
PHP:
<?php
// Contact subject
$subject ="$subject"; 
// Details
$message="$detail";
 
// Mail of sender
$mail_from="$customer_mail"; 
// From 
$header="from: $name <$mail_from>";
 
// Enter your email address
$to ='alejandro@tudisenas.com';
 
$send_contact=mail($to,$subject,$message,$header);
 
// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}?>

You have removed the code that sets $subject , $detail and $customer_mail;

You need

PHP:
$customer_mail = $_REQUEST['customer_mail'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['detail'] ;
 

medina

x10 Addict
Community Support
Messages
1,811
Reaction score
7
Points
38
wooooow thank you very much, this is the problem. Now i know that i have to put $_REQUEST.... if it is not much problem you can tell me the error in the last Script?

<?
if(isset($_POST['enviar'])) {
mail('alejandro@tudisenas.com','Mensaje enviado de la web',$_POST['mensaje'],"From: {$_POST['nombre']} <{$_POST['email']}>") ;
echo 'El email ha sido enviado con éxito.' ;
}
?>
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
Nombre:<br />
<input type="text" name="nombre"><br />
Email:<br />
<input type="text" name="email"><br />
Mensaje:<br />
<textarea name="mensaje" cols="30" rows="5"></textarea><br /><br />
<input type="submit" name="enviar" value="enviar">
</form>

This have a $_REQUEST and dont send the mail!... thank you descalzo!!....
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
It never sends the mail and prints 'El email ha sido enviado con éxito.'?

It just redisplays the form?

Are you clicking the Enviar button or just pressing 'Enter'? Some browsers submit the form but do not send the button value if 'Enter' is pressed.
I usually have a hidden field (named 'submitted' and value 'yes') and test for that instead of testing for the button value.
 
Status
Not open for further replies.
Top