How to use PHPMailer

Hi @Infinity
Can you sort this out?
2020-04-07 08:59:41 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP n126sm9687006qke.5 - gsmtp
2020-04-07 08:59:41 CLIENT -> SERVER: EHLO twilyhoney.000webhostapp.com
2020-04-07 08:59:41 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2a02:4780:bad:7:fced:1ff:fe07:21]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2020-04-07 08:59:41 CLIENT -> SERVER: STARTTLS
2020-04-07 08:59:41 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2020-04-07 08:59:41 CLIENT -> SERVER: EHLO twilyhoney.000webhostapp.com
2020-04-07 08:59:41 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2a02:4780:bad:7:fced:1ff:fe07:21]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2020-04-07 08:59:41 CLIENT -> SERVER: AUTH LOGIN
2020-04-07 08:59:41 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2020-04-07 08:59:41 CLIENT -> SERVER: [credentials hidden]
2020-04-07 08:59:41 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2020-04-07 08:59:41 CLIENT -> SERVER: [credentials hidden]
2020-04-07 08:59:41 SERVER -> CLIENT: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu534-5.7.14 Gud7Q0NNlfi7ZC2scx67OjG7kWc3N3r5AYDwkul8DSIl1oOXzbUKRQvyK5JEu8zzAu3Gs534-5.7.14 aj8NCDlMfk2pLMkshlfoe9XVABHDr1m6rM3jKm1p5Y6r-E9HDoCWqEsDxE0Cb8kh>534-5.7.14 Please log in via your web browser and then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google.com/mail/answer/78754 n126sm9687006qke.5 - gsmtp
2020-04-07 08:59:41 SMTP ERROR: Password command failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu534-5.7.14 Gud7Q0NNlfi7ZC2scx67OjG7kWc3N3r5AYDwkul8DSIl1oOXzbUKRQvyK5JEu8zzAu3Gs534-5.7.14 aj8NCDlMfk2pLMkshlfoe9XVABHDr1m6rM3jKm1p5Y6r-E9HDoCWqEsDxE0Cb8kh>534-5.7.14 Please log in via your web browser and then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google.com/mail/answer/78754 n126sm9687006qke.5 - gsmtp
SMTP Error: Could not authenticate.
2020-04-07 08:59:41 CLIENT -> SERVER: QUIT
2020-04-07 08:59:41 SERVER -> CLIENT: 221 2.0.0 closing connection n126sm9687006qke.5 - gsmtp
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Thanks before :slight_smile:

Following the link in your error message

https://support.google.com/mail/answer/7126229?visit_id=637218881097779150-563275999&rd=2#cantsignin

It seems to be your password is not being accepted, if you’ve provided the correct password then try following the steps on the link above regarding 2 step or less secure apps depending on your account settings. :slight_smile:)

I followed all the steps and locally on xampp it works, but when I go to 000webhost it gives a connection error.

We will need a bit more information sadly, try troubleshooting or using alternative hosting.
This is only free hosting and we can only provide limited support to be fair.

Hola que tal, soy nuevo y apenas estoy practicando y aprendiendo.
apenas hago pruebas con phpmailer y de manera local funciona hasta la parte de mandar el correo de gmail, pero no llega al correo redireccionado por 000webhost.
subi los archivos al host, cambie la ubicación de los requieren e inicie una prueba pero ahora no jala, me dice su página no funciona http error 500
no pude poner el codigo aqui pero esta aqui el ejemplo https://taxielcapi.000webhostapp.com/phpmailer/contacto.php
espero de sus buenos consejos
Saludos a todos y gracias

You mention mail redirected from 000webhost?
Are you using mail forwarding services on 000webhost?
I would advise not using that, try out ImprovMX.com or use an actual @googlemail/gmail account to recieve in the mails to instead of the custom domain if that makes sense?

Let me know further information on your exact issue if you are still struggling and we will do our best we can but with the mailing services there is limited troubleshooting we can do and advise upgrading to avoid mailing issues or trying other free hosting / diagnosing / troubleshooting yourself :frowning:

Hola que tal, use la cuenta real en local y se me llegan los correos, apenas iniciare pruebas en el host.
y seguire intentando poder hacer el reenvio con el dominio.

ahora mi duda es como desaparesco los mensajes de client -> server que me salen en la pagina web.


Saludos

Hola buenas noches, todo resuelto en lo que va de PHPMailer, es tema aprendido gracias
Saludos

$mail->SMTPDebug = 2; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages

As mentioned, you can set the above value to ‘0’ to stop those messages.

Let us know if you’ve any other issues.

hello Infinity and more,

I tried all the procedures mentioned above and I couldn’t solve my problem.

my website appears that the message was sent, however it is not sent to the email.

Can you help me please …

@ambtestebr Try using other SMTP providers like Mailjet or sendgrid.

Hello @akhilkumar332,

im totally newbie. Create account on mailjet, but dont know how integrate to receive email.

now is same, message are send on PHPMailer, but any message come on gmail with API maijet.

can help me…

@ambtestebr Have you followed the above tutorial properly.

*Note: Inorder to use Mailjet/sendgrid SMTP you must have a custom domain(can be free/paid).

If you don’t have it i suggest follow the above tutorial and try again.

Let us know where you’re stuck so that we can guide you.