Re: no error, mail is not sending

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Then the problem is in the mail server that for some reason is not 
sending the mail.

Try to add another parameter to mail function in order you can get any 
possible error from mail server like this:

$send = mail($to, $subject, $body, $headers,"-fmyemail@xxxxxxxxxxxx");
$send2 = mail($from, $subject2, $autoreply, $headers2, "-fmyemail@xxxxxxxxxxxx");

This parameter -f will force to add "myemail@xxxxxxxxxxxx" as a 
Return-Path header, and then, if the mail server is not able to send the 
mail, it will return it to you with a message error (and then you can 
check what happens in the mail server). 

Regards,
jan

sravani98_gogineni escribió:
> code output is "yes done",but mail is not sending
>
> this is my code..........
>
> <?php
> $to = $_REQUEST['sendto'] ;
> $from = $_REQUEST['Email'] ;
> $name = $_REQUEST['Name'] ;
> $headers = "From: $from";
> $subject = "Web Contact Data";
>
> $fields = array();
> $fields{"Name"} = "Name";
> $fields{"Company"} = "Company";
> $fields{"Email"} = "Email";
> $fields{"Phone"} = "Phone";
> $fields{"list"} = "Mailing List";
> $fields{"Message"} = "Message";
>
> $body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
>
> $headers2 = "From: noreply@xxxxxxxxxxxxxxx";
> $subject2 = "Thank you for contacting us";
> $autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.oursite.com";
>
> if($from == '') {print "You have not entered an email, please go back and try again";}
> else {
> if($name == '') {print "You have not entered a name, please go back and try again";}
> else {
> $send = mail($to, $subject, $body, $headers);
> $send2 = mail($from, $subject2, $autoreply, $headers2);
> if($send)
> {
> print "yes done";
> }
> else
> {print "We encountered an error sending your mail, please notify webmaster@xxxxxxxxxxxxxxx"; }
> }
> }
> ?> 
>  
>     <form method="post" action="contact.php">
>     <table bgcolor=#ffffcc align=center>
>     <tr><td colspan=2><strong>Send Friend request</strong></td></tr>
>     <tr><td>Friend's mail id</td><td><input type="text" name="sendto"></td></tr>
>     <tr><td><font color=red>*</font>Your Name:</td><td><input size=25 name="Name"></td></tr>
>     <tr><td><font color=red>*</font>Your Email:</td><td><input size=25 name="Email"></td></tr>
>     <tr><td colspan=2>Message:</td></tr>
>     <tr><td colspan=2 align=center><textarea name="Message" rows=5 cols=35></textarea></td></tr>
>     <tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr>
>     <tr><td colspan=2 align=center><small>A <font color=red>*</font> indicates a field is required</small></td></tr>
>     </table>
>     </form>
>     
>
>
>
> ------------------------------------
>
> Are you looking for a PHP job?
> Join the PHP Professionals directory Now!
> http://www.phpclasses.org/jobs/
> Yahoo! Groups Links
>
>
>
>
>   


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux