user5698313
user5698313

Reputation:

Why is either PHPMailer or SendMail not working?

I have a php script that uses phpmailer:

require("PHPMailer/PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = false;
$mail->IsSendmail();
$mail->Host = "localhost";
$mail->Port = 587;

$mail->SetFrom($from, 'BuzzZap');

$mail->Subject = $subject;
$mail->MsgHTML($body);
$mail->AddAddress($to, $to);
if ($mail->Send()) {
    echo "Message sent!";
    return true;
} else {
    echo "Mailer Error: " . $mail->ErrorInfo;
    return false;
}

(Some variables are defined elsewhere, but are definitely defined) So, I have sendmail running on port 25 and 587 (says when I run netstat -tulnp) on a live server. The script does say "successfully sent" and produces no errors, warnings, etc. Mail.log shows:

 8 17:33:23 casparwylie sendmail[2601]: u18HXNFd002601: Authentication-Warning: casparwylie: www-data set sender to [email protected] using -f
Feb  8 17:33:23 casparwylie sendmail[2601]: u18HXNFd002601: [email protected], size=2178, class=0, nrcpts=1, msgid=<[email protected]>, relay=www-data@l$
Feb  8 17:33:23 casparwylie sm-mta[2602]: u18HXNK9002602: from=<[email protected]>, size=2393, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, dae$
Feb  8 17:33:23 casparwylie sendmail[2601]: u18HXNFd002601: to="[email protected]" <[email protected]>, [email protected] (33/33), delay=00:00:00, xdelay=00:0$
Feb  8 17:33:23 casparwylie sm-mta[2604]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Feb  8 17:33:24 casparwylie sm-mta[2604]: u18HXNK9002602: to=<[email protected]>, delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=122393, relay=gmail-smtp-in.l.google.com. [7$
Feb  8 17:33:26 casparwylie sendmail[2606]: u18HXQoo002606: Authentication-Warning: casparwylie: www-data set sender to [email protected] using -f
Feb  8 17:33:26 casparwylie sendmail[2606]: u18HXQoo002606: [email protected], size=2178, class=0, nrcpts=1, msgid=<[email protected]>, relay=www-data@l$
Feb  8 17:33:26 casparwylie sm-mta[2607]: u18HXQXe002607: from=<[email protected]>, size=2393, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, dae$
Feb  8 17:33:26 casparwylie sendmail[2606]: u18HXQoo002606: to="[email protected]" <[email protected]>, [email protected] (33/33), delay=00:00:00, xdelay=00:0$
Feb  8 17:33:26 casparwylie sm-mta[2609]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Feb  8 17:33:26 casparwylie sm-mta[2609]: u18HXQXe002607: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=122393, relay=gmail-smtp-in.l.google.com. [7$

for each email I try to send.

However, I quite simply do not receive an email when checking [email protected].

Would appreciate any help - I'm clearly misunderstanding something!

Upvotes: 2

Views: 1079

Answers (1)

JuZer
JuZer

Reputation: 783

While You are sending e-mails thru SMTP located at localhost You don't have to specify SMTP related settings. So try to remove these lines:

$mail->IsSMTP();
$mail->SMTPAuth = false;
$mail->IsSendmail();
$mail->Host = "localhost";
$mail->Port = 587;

Note: don't forget to check Your SPAM folder

Upvotes: 1

Related Questions