Sunday, July 11, 2010

Email script unable to work (Php)?

hi, i get these coding from online but when i try to use it for my own it does not seem work. It is unable to sent a confirmation letter to my email account. Can anyone tell me wat the problem? thanks


$pfw_header = "From:zxy@hotmail.com";


$pfw_subject = "Comfirmation";


$pfw_email_to = "$email";


$pfw_message = "This is to confirm we have gotten your email.";


@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

Email script unable to work (Php)?
Make sure you have your mail server settings correctly set in your configuration file.





Also, why do you have the @ in front of your mail function? That seems to be unnecessary. Do you get an error, or just never receive the e-mail?
Reply:Try putting a \r\n on the end of the header line:





$pfw_header = "From:zxy@hotmail.com\r\n";


$pfw_subject = "Comfirmation";


$pfw_email_to = "$email";


$pfw_message = "This is to confirm we have gotten your email.";


@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;





Some times the carriage return and newline are needed after each header. Try subbing $email for you actual email addy. Try removing the @ in front of the mail function. I got it to work on my server.


No comments:

Post a Comment