Page 1 of 1

How to send email using PHP code

Posted: Mon Mar 20, 2006 6:08 am
by Vadamalar

Code: Select all

<?php

mail("To:$Todomainname@.com","$Subject","$some message body","From:$Fromdomainname.com");
?>

If i try to execute this, i am getting error reporting like "SMTP server response: 550 5.7.1 Unable to relay for Todomainname.com".

Please help it out.

Posted: Mon Mar 20, 2006 7:06 am
by shiznatix
"To:$Todomainname@.com"

That is your problem. whats this To: doing there? This section is supposed to be just a e-mail address, the address that you want to send the e-mail to. it should be like

Code: Select all

mail("someone@hotmail.com","$Subject","$some message body","From:$Fromdomainname.com");
or somthing like that.

Posted: Mon Mar 20, 2006 10:29 am
by John Cartwright
can I recommend PHPmailer? You will likely have a lot of problems sending to hotmail and other email providers becasue of misused headers. PHPmailer is very effective and 99.9% gets the job done ;)