0

i have a website wherein you can inquiry or leave questions and comments and send it via email, the code runs perfectly but it doesn't send email. here is my code:

$myemail = 'albertdaracan@gmail.com';//<-----Put Your email address here.

$fname = "albert";
$lname = "daracan";


$subject = "Magosaburo Inquery Form";
$email_address = $_POST['email']; 
$message = "Name: ".$fname." ".$lname;
$message = "test";
$to = $myemail; 
$email_subject = $subject;
$email_body = $message; 

$headers = "From: $fname $lname <$email_address>\n"; 
$headers .= "Cc: ";     
$headers .= "Reply-To: $email_address";


//redirect to the 'thank you' page

if(mail($to,$email_subject,$email_body,$headers)){
        echo "mail successful send";
}else{ 
        echo "Could not send you mail, Please try again later";
}


$message2 = "test";

$to2 = $email_address; 
$email_subject2 = "Magosaburo";
$email_body2 = "$message2"; 

$headers2 = "From: Magosaburo <$myemail>\n"; 
$headers2 .= "Reply-To: $email_address";


//redirect to the 'thank you' page
if(mail($to2,$email_subject2,$email_body2,$headers2)){
        echo "mail successful send";
}else{ 
        echo "Could not send you mail, Please try again later";
}

my other works was fine it send email, but it is in other server...

Albert
  • 327
  • 1
  • 3
  • 16
  • `mail()` returns if the mail is send and try to find what is the return.. – 웃웃웃웃웃 Aug 08 '13 at 04:55
  • Possible duplicate: http://stackoverflow.com/questions/8803994/ – Amal Murali Aug 08 '13 at 04:57
  • the return is mail successful send mail successful send – Albert Aug 08 '13 at 04:57
  • Not sure if it is a copy/paste issue, but `$fname = "albert"`,`$lname = "daracan"`, and `$message = "Name: ".$fname." ".$lname` are missing a closing `;`, and the next line `$message = "test";` is overwriting the line before. – Sean Aug 08 '13 at 04:57
  • i dont have access to the php.ini of that server,. – Albert Aug 08 '13 at 04:58
  • my bad, i edit it here in stockover flow, because they are too many i just put two... is there a different if i use code igniter email, than mail form php? – Albert Aug 08 '13 at 05:02

1 Answers1

0

why not try to fix this issue first

$fname = "albert" //missing semi colon $lname = "daracan" //missing semi colon

$subject = "Magosaburo Inquery Form"; //terminated here

may be the values were not assigned well which causes the faultness

Semi-Friends
  • 480
  • 5
  • 17