dennismonsewicz Posted September 23, 2008 Share Posted September 23, 2008 I am trying to use the mail() function on my server and it doesn't work. I tried it on another server and it works fine, but not on the current server. Code: <?php $Name = "Da Duder"; //senders name $email = "dennismonsewicz@gmail.com"; //senders e-mail adress $recipient = "dennismonsewicz@gmail.com"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "testing"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; if(mail($recipient, $subject, $mail_body, $header)) { echo '<p>Mail sent successfully...</p>'; } else { echo '<p>Mail delivery impossible!</p>'; } //mail command ?> I receive the "Mail delivery impossible" when I try running the page on one server and the "Mail sent successfully..." on another server Any ideas? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 23, 2008 Share Posted September 23, 2008 Your outgoing mail server needs to be set up on the one that isn't working. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 23, 2008 Share Posted September 23, 2008 Add the following two lines immediately after your <?php tag - ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 23, 2008 Author Share Posted September 23, 2008 thanks for the help... I was able to locate the address for our SMTP server and adjust the php.ini file accordingly Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.