PHP Mailer - DOUBLE CHECK

zardiw

Perch
If you are using this, and you are using SMTP Auth (which you should be if you're using a user name/pw to log into your mail server to send mail) make SURE that the port in class.smtp.php is 587 and not 25.

I thought there was a problem with the mail server, but it was my SCREWUP that failed to notice this.

Sorry again...............z
 
If you are using this, and you are using SMTP Auth (which you should be if you're using a user name/pw to log into your mail server to send mail) make SURE that the port in class.smtp.php is 587 and not 25.

I thought there was a problem with the mail server, but it was my SCREWUP that failed to notice this.

Sorry again...............z

If you don't want to change the smtp class file you are also able to alter the default smtp port within a file which inherits the phpmailer class
e.g $mail->IsSMTP();
$mail->Port=587;

I'm not a php coder but this worked for me.
 
I'm having issues with one of my clients PHP forms. No email has been received since 7/29 and they usually receive 1-2 a day at least. I've changed the port to 587 but emails are still not being delivered. No other changes have occurred and the PHP script returns "Mail Sent". They are using mail 11 and on web 10. The email is sent to a local account with forwards to their Gmail account.

Any ideas why this occurring or how to fix it? Is there an issue with mail 11 or web 10? Was mail 11 recently migrated? Below is the basic code for reference. Thanks!

try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled

$body = $postData; //file_get_contents('contents.html');
$body = preg_replace('/\\\\/','', $body); //Strip backslashes

$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 587; // set the SMTP server port
$mail->Host = "mail.domain.com"; // SMTP server
$mail->Username = "[email protected]"; // SMTP server username
$mail->Password = "xxxxxxxxxxxx"; // SMTP server password

$mail->IsSendmail(); // tell the class to use Sendmail

$mail->AddReplyTo($Email,$First_Name ." " . $Last_Name);

$mail->From = "[email protected]";
$mail->FromName = "Domain Web Site";

$to = "[email protected]";

$mail->AddAddress($to);

$mail->Subject = "Domain " . $Contact_Subject . " Submission";

$mail->AltBody = $postData; //"To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap

$mail->MsgHTML($body);

$mail->IsHTML(true); // send as HTML

$mail->Send();
$emailStatus = 'Sent';
} catch (phpmailerException $e) {
$errtxt = $e->errorMessage();
}
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
 
Mail11 was on 7/7 so nothing very recent, and certainly well before the 29th. Web10 was also migrated, actually a very long time ago as it was done due to hardware failure back in Jan.
 
Thanks for the reply Stephen. Really weird, I assumed the 587 port would fix the issue but no emails are coming thru and no errors are returned by the program. Any way to track these emails down or troubleshoot further? I put a ticket in with more details as well, #AFS-81333-251. Thanks!
 
Thanks for the reply Stephen. Really weird, I assumed the 587 port would fix the issue but no emails are coming thru and no errors are returned by the program. Any way to track these emails down or troubleshoot further? I put a ticket in with more details as well, #AFS-81333-251. Thanks!
Ticket will be best yes there are ways, but I don't do that, so I cannot directly help :)
 
The senior admins are working on this but I'm flummoxed as to where the e-mails are going and some other issues uncovered while troubleshooting the PHP mailer issue.

When the form is submitted the PHP malier v5.1 script returns "Mail Sent". I tried removing all the SMTP settings and setting them to "" (nothing) and the script still says the email was sent. This should throw some type of error???

I then tried to purposely throw an error on the PHP page and the server responds with a 500 error. Before this issue occurred I was able to set the PHP error reporting to "error_reporting (E_ALL);
ini_set ('display_errors', true);, which would print the errors to the screen, but this does not work anymore. Is it possible that some PHP settings have changed that will always show a successful send of the email? Is the form mailer V5.1 incompatible with the PHP version 5.2.14?

Any idea what is causing these issues? I'm really in a pinch as my client has not received emails from the site in over a week, since 7/29. Thanks!
 
OK, I think I found the issue with my php Mailer script. Not sure why, probably lazy copy and paste from some old code but the script contained both of the following:

$mail->IsSendmail();
$mail->IsSMTP();

I think I had issues with IsSMTP previously so I tried and used IsSendMail. This was working until 7/29/2011 so I'm still unclear why it stopped working but removing the IsSendMail fixes the issue and emails are being delivered.

Was sendmail available previously? Anyone know why this did not produce an error?

Anyone else having php Mailer issues may want to check for the same. Cheers!
 
Back
Top