contactskn 2 Report post Posted December 25, 2008 Hello friends first of all a happy christmas to you all there. I have coded in php somewhat similar code shown below but it is showing error that is echoing "The email($email_subject) was NOT sent." I am not able to understand why it is happening. Am I wrong with my code or some other problem please help me out dear friends. <?php$email_to = "somebody@email.com";$email_subject = "Test E-Mail (This is the subject of the E-Mail)";$email_body = "This is the body of the Email \nThis is a second line in the body!";if(mail($email_to, $email_subject, $email_body)){ echo "The email($email_subject) was successfully sent.";} else { echo "The email($email_subject) was NOT sent.";}?> Notice from truefusion: Place all code within CODE or CODEBOX bbcode. Thanks. Share this post Link to post Share on other sites
pyost 0 Report post Posted December 25, 2008 Is the code just similar, or exactly the same? The script you have posted should work, though it might be a good idea to add some headers to the e-mail (refer to the PHP mail() page). There is a slight chance that you don't have the modules required for sending mail, so it would be useful to know where you are testing the script. Share this post Link to post Share on other sites
truefusion 3 Report post Posted December 25, 2008 Where are you testing this at? On a local server or remote? If on a local server, bear in mind that PHP cannot send mail on its own and requires a MTA that supports SMTP, like postfix or other, to be installed on the server and configured properly. If on a remote server, then you may want to contact the administrator to see if the PHP mail function has not been disabled, etc. Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted December 25, 2008 In my experience, some Servers require a From Header to be included in emails sent via php.I believe this is an anti-spam requirement from the Server Admins, and assumes as noted above that the server allows php mail functionality. Share this post Link to post Share on other sites