Gmail mailer authentication issue

Hi ,

I had try many different recommendations from the forum to solve the 500 error (mailer smtp authentication error), without success. I setup my gmail account for less secure apps, i disable two way authentication, i enable /disable ssl with no no luck!, Is any other issue that i must be aware that i cannot solve this ?

My current settings: SMTP server = smtp.gmail.com, port 465 SSL = enabled, username xxxxxx@gmail.com (i tried with the username without domain).

message: “SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Gmail requires you to enable the “Less secure apps” option in your profile in order to be able to use its SMTP server.

  1. Log into your GMAIL account.
  2. Navigate to the ‘Less secure apps’ page.

  1. Toggle to turn this feature ‘ON’.
  2. Wait a couple of minutes for Google to update this setting.
  3. Test again - it should now send correctly via SMTP.

Thanks Teodor for your reply.

I made the less secure app change 30 minutes before i tested now without success.

Can you please check if my settings are ok?

image

I am using username without gmail domain. Is this ok?

It needs the @gmail.com as far as my tests show.

Please open the following file in your site root:

/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php

and edit line 401 from:

public $SMTPDebug = 1;

to

public $SMTPDebug = 3;

save the file and try sending the mail once again. You will see more detailed error in the console - please paste it here.

the error now is 200 and the log details

2020-11-27 21:44:37 Connection: opening to localhost:25, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
2020-11-27 21:44:37 Connection failed. Error #2: stream_socket_client(): unable to connect to localhost:25 (Cannot assign requested address) [/var/www/html/dmxConnectLib/PHPMailer/PHPMailer/SMTP.php line 374]
2020-11-27 21:44:37 SMTP ERROR: Failed to connect to server: Cannot assign requested address (99)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Fatal error : Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /var/www/html/dmxConnectLib/PHPMailer/PHPMailer/SMTP.php:277) in /var/www/html/dmxConnectLib/dmxConnect.php:86 Stack trace: #0 [internal function]: exception_error_handler(2, ‘Cannot modify h…’, ‘/var/www/html/d…’, 86, Array) #1 /var/www/html/dmxConnectLib/dmxConnect.php(86): header(‘HTTP/1.1 500 In…’) #2 [internal function]: exception_handler(Object(PHPMailer\PHPMailer\Exception)) #3 {main} thrown in /var/www/html/dmxConnectLib/dmxConnect.php on line 86

Fatal error : Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /var/www/html/dmxConnectLib/PHPMailer/PHPMailer/SMTP.php:277) in /var/www/html/dmxConnectLib/dmxConnect.php:47 Stack trace: #0 [internal function]: exception_error_handler(2, ‘Cannot modify h…’, ‘/var/www/html/d…’, 47, Array) #1 /var/www/html/dmxConnectLib/dmxConnect.php(47): header(‘HTTP/1.1 500 In…’) #2 [internal function]: fatal_handler() #3 {main} thrown in /var/www/html/dmxConnectLib/dmxConnect.php on line 47

sorry not error , response!

How is your mailer defined? Is it under globals or inline in the server action as a step?
I see it says:

unable to connect to localhost:25

instead of GMAIL, which is strange.

It is in under global

image

I had try to setup it inline but i didn’t success.

So in your server action, are you sure your send mail step has this mailer selected in the dropdown?

Yes

No, no no. You should NOT use setup mail step in the server action. Remove it from the server action.
Once you define the mailer globally, you just need a SEND MAIL step in the server action, referencing to the global mailer.
After you do that, please set this option back to 1:

public $SMTPDebug = 1;

And here’s more info about globals:

1 Like

Thanks Teodor, now is working , you make my day! -)

2 Likes

Just an update for this thread:
Google no longer allows low-security apps.
For this reason, you have to go to the security tab on your Google account, enable two-step verification, set an app password, and use it instead of your Google password.

1 Like