Magento 2 emails not sending

Hi,
I have magento 2 install on ubuntu 18, apache and mysql on a cloud server.
I notice that confirmation emails, and transactional emails are not getting sent.
I checked the var/log for clues and this is what I found.

[2019-08-23 07:34:38] main.CRITICAL: Unable to send mail: Unknown error {"exception":"[object] (Magento\\Framework\\Exception\\MailException(code: 0): Unable to send mail: Unknown error at /var/home-directory/vendor/magento/module-email/Model/Transport.php:101, Zend\\Mail\\Transport\\Exception\\RuntimeException(code: 0): Unable to send mail: Unknown error at /var/home-directory/vendor/zendframework/zend-mail/src/Transport/Sendmail.php:305)"} []
[2019-08-23 07:36:33] main.CRITICAL: Unable to send mail: Unknown error {"exception":"[object] (Magento\\Framework\\Exception\\MailException(code: 0): Unable to send mail: Unknown error at /var/home-directory/vendor/magento/module-email/Model/Transport.php:101, Zend\\Mail\\Transport\\Exception\\RuntimeException(code: 0): Unable to send mail: Unknown error at /var/home-directory/vendor/zendframework/zend-mail/src/Transport/Sendmail.php:305)"} []
[2019-08-23 11:04:42] main.CRITICAL: Unable to unserialize value. Error: Syntax error {"exception":"[object] (InvalidArgumentException(code: 0): Unable to unserialize value. Error: Syntax error at /var/home-directory/vendor/magento/framework/Serialize/Serializer/Json.php:39)"} []
[2019-08-23 11:04:44] main.CRITICAL: Unable to unserialize value. Error: Syntax error {"exception":"[object] (InvalidArgumentException(code: 0): Unable to unserialize value. Error: Syntax error at /var/home-directory/vendor/magento/framework/Serialize/Serializer/Json.php:39)"} []'

please, can someone help?

Hi @Garyy and welcome.

Thank you for sharing what you’ve discovered so far. This isn’t an issue I’ve run into myself, but a quick Google search does reveal that others have been in the same boat.

Firstly, based on the timestamps, I’m going to assume 2 things:

  1. The two “unable to send mail” entries were printed when you were trying to email
  2. The unserialize value” messages aren’t related

Can you tell us

  1. What version of Magento 2 are you using?
  2. Have you ever been able to send emails on your web server before (whether on Magento or another Web App)?
  3. Is your server configured to handle SMTP?
  4. or Are you using a 3rd party SMTP Service (e.g. Gmail/Mandrill) with a 3rd party Module (e.g. Mageplaza/Ebizmarts) to manage your emails?

Setting up SMTP on your Web Server
Personally, I’ve always used Mandrill to manage my emails - Therefore, I’ve never needed configure my web server to do it. However, I think this article by DigitalOcean (How To Install and Configure Postfix on Ubuntu 18.04) may help to get your web server up and running to handle emails. Obviously, that’s assuming that your Magento 2 issue stems from this.

O wow Craig. Thanks for responding! I followed your Magento and web server setup tutorial.
It made the process so easy I started to follow you!
Thanks a lot!
Now to this issue:
Can you tell us

  1. What version of Magento 2 are you using?
    I am using Magento 2.3.2

  2. Have you ever been able to send emails on your web server before (whether on Magento or another Web App)?
    No I haven’t.

  3. Is your server configured to handle SMTP?
    Yes. I have postfix and Dovecot installed and configured using this guide:
    https://upcloud.com/community/tutorials/secure-postfix-using-lets-encrypt/

  4. or Are you using a 3rd party SMTP Service (e.g. Gmail/Mandrill) with a 3rd party Module (e.g. Mageplaza/Ebizmarts) to manage your emails?
    No. I had the mind to connect Klaviyo to Magento but this error is had me put a pause on that.
    Honestly, am a freshly milled newbie. Am learning as I go.

I initially followed the tutorial on the digital ocean link in your message but for some reason, the s-nail just screwed up my server configuration so I restored the server and went with the upcloud tutorial instead.

I like to use an external service to manage emails. One less thing to worry about but am bootstrapping at the moment.

Any cost friendly options?
What direction should I go?

Best regards and thanks again!

Truthly, I’m not sure what the cause of the issue is - I only suspect it to be a server configuration issue.

Using an external service to handle emails has always been the default way for me too. As I mentioned before, I use Mandrill (Paid SMTP service) linked to Ebizmarts Mandrill module to connect it all up.

I’ve seen a couple of people mention that they’ve had success using Gmail (SMTP service). Ref: Magento 2 Version 2.3 Using G Suite to Email Via SMTP M2 by Mageplaza

I realise this turns into a “workaround” for your issues rather than a “fix” to the original problem. But I’m not sure what else to suggest as I’m unable to recreate the issue.

hi Craig,
thanks for your response. I reinstalled and configured both server and magento. then went with an external source. i figure it takes email server maintenance off my todo list.

thanks!

No problem. Let met know how you get on, if it solves your issue.