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 ”
Teodor
November 27, 2020, 9:09pm
2
Gmail requires you to enable the “Less secure apps ” option in your profile in order to be able to use its SMTP server.
Log into your GMAIL account.
Navigate to the ‘Less secure apps ’ page.
Toggle to turn this feature ‘ON’.
Wait a couple of minutes for Google to update this setting.
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?
I am using username without gmail domain. Is this ok?
Teodor
November 27, 2020, 9:38pm
4
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!
Teodor
November 27, 2020, 9:50pm
7
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
I had try to setup it inline but i didn’t success.
Teodor
November 27, 2020, 9:59pm
9
So in your server action, are you sure your send mail step has this mailer selected in the dropdown?
Teodor
November 27, 2020, 10:03pm
11
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:
Intro
The Globals allow you to define and re-use Database Connections and other Settings (1), Variables / Input Parameters (2) and API Action Steps (3) across all your API Actions in the project:
[Screenshot_2]
Whenever you need a Database Connection, Mailer or Security Provider you just need to define them once in the Globals and they will be available for all your Server Actions in the project.
Defining Global Variables / Input Parameters
You can easily define a variable and access it f…
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