Phpmailer: why phpMailer fails in sometimes?

Created on 2 Mar 2017  路  4Comments  路  Source: PHPMailer/PHPMailer

Hi.
I'm using PHPMailer to send an email for new user activation.
I followed several tutorials, but I dont know why my email does not sent in sometimes.
I'm using localhost by external SMTP (google).
for example:
3 times send email successfully but in a next attempt it fails.
why?
can I use a while loop for send() method until it's return be true?

All 4 comments

If you want reliability, send via a local mail server (MTA) which will deal with intermittent connections, retrying etc - PHPMailer is not an MTA.

Yes you can send in a loop - look at the mailing list example provided with PHPMailer for how to do it efficiently.

how can I send an email by MTA in php code?

Hehe

Install a mail server:

apt-get install postfix
dpkg-reconfigure postfix

Follow the PHPMailer example in the readme with $mail->Host = 'localhost';.

After that, google is your friend.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

judodan picture judodan  路  5Comments

HS79 picture HS79  路  7Comments

LouieZachary picture LouieZachary  路  6Comments

Synchro picture Synchro  路  5Comments

velocius picture velocius  路  4Comments