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?
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.