Mailer Error SMTP Error: Data not accepted

Thanks @George, I get this error when I do what you suggest:

{"code":2,"file":"\/volume1\/web\/instance_1\/dmxConnectLib\/PHPMailer\/PHPMailer\/PHPMailer.php","line":1910,"message":"SMTP Error: data not accepted.","trace":"#0 \/volume1\/web\/instance_1\/dmxConnectLib\/PHPMailer\/PHPMailer\/PHPMailer.php(1601): PHPMailer\\PHPMailer\\PHPMailer->smtpSend('Date: Mon, 16 N...', 'This is a multi...')\n#1 \/volume1\/web\/instance_1\/dmxConnectLib\/PHPMailer\/PHPMailer\/PHPMailer.php(1437): PHPMailer\\PHPMailer\\PHPMailer->postSend()\n#2 \/volume1\/web\/instance_1\/dmxConnectLib\/modules\/mail.php(132): PHPMailer\\PHPMailer\\PHPMailer->send()\n#3 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(193): modules\\mail->send(Object(stdClass), '')\n#4 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(157): lib\\App->execSteps(Object(stdClass))\n#5 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(127): lib\\App->execSteps(Array)\n#6 \/volume1\/web\/instance_1\/dmxConnectLib\/modules\/core.php(92): lib\\App->exec(Object(stdClass), true)\n#7 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(193): modules\\core->condition(Object(stdClass), '')\n#8 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(157): lib\\App->execSteps(Object(stdClass))\n#9 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(127): lib\\App->execSteps(Array)\n#10 \/volume1\/web\/instance_1\/dmxConnectLib\/modules\/core.php(92): lib\\App->exec(Object(stdClass), true)\n#11 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(193): modules\\core->condition(Object(stdClass), '')\n#12 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(157): lib\\App->execSteps(Object(stdClass))\n#13 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(127): lib\\App->execSteps(Array)\n#14 \/volume1\/web\/instance_1\/dmxConnectLib\/modules\/core.php(90): lib\\App->exec(Object(stdClass), true)\n#15 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(193): modules\\core->condition(Object(stdClass), '')\n#16 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(157): lib\\App->execSteps(Object(stdClass))\n#17 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(127): lib\\App->execSteps(Array)\n#18 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(116): lib\\App->exec(Object(stdClass), false)\n#19 \/volume1\/web\/instance_1\/dmxConnectLib\/lib\/App.php(94): lib\\App->exec(Object(stdClass))\n#20 \/volume1\/web\/instance_1\/dmxConnect\/api\/Hot_Account\/send_ha.php(8): lib\\App->define(Object(stdClass))\n#21 {main}"}

Now you the real error!

This might help:

@patrick can help as well.

If this is the case, it’s a big deal, as this was working before the upgrade. I’m sending mail through sendgrid via a service account, what they call an api key. I can’t have the user be ‘api’, I need the from to be a different person depending on the logic behind. @patrick @George

Maybe follow these steps:

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.

I’m confused. :slight_smile:
You can send through sendgrid without using phpmailer.

Is that what is broken?

@mebeingken in the latest updates we’ve updated our PHP mailer component to use PHPMailer and it is used to send mails, using SMTP.
I’m curious to see the detailed error log returned.

2 Likes

Ahhh…got it

1 Like

My debug was set to 0, when set to 3, this is the excerpt of interest:

2020-11-16 18:59:14 SMTP ERROR: DATA END command failed: 550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements
SMTP Error: data not accepted.
2020-11-16 18:59:14 CLIENT -> SERVER: QUIT
2020-11-16 18:59:14 SERVER -> CLIENT: 221 See you later
2020-11-16 18:59:14 Connection: closed
Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /volume1/web/instance_1/dmxConnectLib/PHPMailer/PHPMailer/SMTP.php:280) in /volume1/web/instance_1/dmxConnectLib/dmxConnect.php:83 Stack trace: #0 [internal function]: exception_error_handler(2, 'Cannot modify h...', '/volume1/web/in...', 83, Array) #1 /volume1/web/instance_1/dmxConnectLib/dmxConnect.php(83): header('Status: 500 Int...') #2 [internal function]: exception_handler(Object(PHPMailer\PHPMailer\Exception)) #3 {main} thrown in /volume1/web/instance_1/dmxConnectLib/dmxConnect.php on line 83 Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /volume1/web/instance_1/dmxConnectLib/PHPMailer/PHPMailer/SMTP.php:280) in /volume1/web/instance_1/dmxConnectLib/dmxConnect.php:44 Stack trace: #0 [internal function]: exception_error_handler(2, 'Cannot modify h...', '/volume1/web/in...', 44, Array) #1 /volume1/web/instance_1/dmxConnectLib/dmxConnect.php(44): header('Status: 500 Int...') #2 [internal function]: fatal_handler() #3 {main} thrown in /volume1/web/instance_1/dmxConnectLib/dmxConnect.php on line 44

It does seem to be a mismatch between the from address and a verified identity. I don’t have access to the dns or the server and too many users to manually verify. I have an old version of the app pre 3.5.x that works with sendgrid (same code), is there anything we can do on the wappler side?

Maybe @patrick can suggest a solution here :slight_smile:

As the error suggests you should add your from address to the verified senders in sendgrid.

It is just an extra security measurement of sendgrid

Hi @George, yes, I’m in the process of doing so, but from a functionality perspective it’s a huge regression, as you have to share your credentials from sendgrid to do so (if you add individual addresses as it assumes they are all yours, and I’m dealing with large amounts of users), when you do not have access to the domain dns (I’m hosted on a subdomain of a larger infrastructure, which is often the case for hospitals, universities, etc…).

This actually puts in jeopardy opening the system to additional users in my current configuration, which I have limited control over.

I appreciate everyone’s help today in narrowing down the issue. I would also suggest putting in the release notes the fact the whole dmxConnectLib ought to be regenerated and uploaded after the 3.5.x or similar future updates (I’m pushing the app via Cloud Foundry which means I need to manually choose which files are uploaded) - for those of us who cannot take advantage of the built-in sync with hosting providers.