mail function not working.no errors but mail was not sending

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

 



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>
    


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

  Powered by Linux