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 = "[email protected]"; //senders e-mail adress $recipient = "[email protected]"; //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? Link to comment https://forums.phpfreaks.com/topic/125486-solved-mail-doesnt-work/ 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. Link to comment https://forums.phpfreaks.com/topic/125486-solved-mail-doesnt-work/#findComment-648753 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); Link to comment https://forums.phpfreaks.com/topic/125486-solved-mail-doesnt-work/#findComment-648759 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 Link to comment https://forums.phpfreaks.com/topic/125486-solved-mail-doesnt-work/#findComment-648889 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.