Getting a "502 5.5.1 Unrecognized command" from the SMTP server
@repox@denizozsen Again, sorry for the delay, but I believe I fixed the underlying issue.
Let me know if you see it again. Also, I’ve added new logging to the service so if you give me the full message (including the ID), I can cross reference with some audit logs.
Getting a "502 5.5.1 Unrecognized command" from the SMTP server
Hi Mike,
Sure, here’s the test script we used. The body text in Repox’s pastie link should be in a file named body.html, in the same directory as the script. And you’ll need to add an include of the SwiftMailer autoloader.
I’ve used placeholders for the API token credentials here.
We’re using the following SwiftMailer version: Swift-5.4.3
$message = \Swift_Message::newInstance()
->setSubject('Test email')
->setFrom(['from@mail.com' => 'Name'])
->setTo(['to@mail.com' => 'Name']);
// The text from body.html reproduces the issue
$message->setBody(file_get_contents(__DIR__ . '/body.html'), 'text/html');
// However, sending with a simple text works just fine
// $message->setBody('Here is your mail', 'text/html');
$transport = \Swift_SmtpTransport::newInstance('smtp.hubapi.com', 587, 'tls')
->setUsername('username@hubid.smtp.hubspot.net')
->setPassword('password');
// Turn off certificate check, for testing purposes
$transport->setStreamOptions(array('ssl' => array('allow_self_signed' => true, 'verify_peer' => false)));
$mailer = \Swift_Mailer::newInstance($transport);
$result = $mailer->send($message);
var_dump($result);
Getting a "502 5.5.1 Unrecognized command" from the SMTP server
Hi Mike,
Thanks for your reply! I’m working on the same Hubspot integration project with Repox. Since he isn’t available at the moment, I’ll reply instead.
We’re using the PHP library SwiftMailer to send SMTP mail, and have successfully sent mails with the same body via some other SMTP servers. Perhaps there’s some problem with the specific combination of SwiftMailer + Hubspot + our particular options + data?
If you could make a simple test with SwiftMailer and our example body text, that would be really helpful. Otherwise I’ll give your suggestion of debug logging a go, when I have some time.
Getting a "502 5.5.1 Unrecognized command" from the SMTP server
Hi Repox,
This is definitely worrying to hear, and I would like to get to the bottom of this. A few questions so we can figure this out:
What are you using to send? Is this using a standard SMTP library?
In this SMTP library, can you enable debug level logging to see what the SMTP exchange looked like?
If you can get the smtp debug logs, that would be tremendously helpful. Otherwise, if we can get the SMTP client library/language, I can try to reproduce it for you.