Question

How to send emails through an External SMTP Service?

Posted June 11, 2020 542 views
UbuntuEmail

I would like to send emails through an External SMTP Service (Yandex) with Sendmail on Ubuntu 18.04.3.

I set everything up: External SMTP Service, Sendmail, hostname. I added the MX record to my DNS.

~hostname
childrengo.org (my domain)

~host childrengo.org
childrengo.org has address <IP>
childrengo.org mail is handled by 10 mx.yandex.net.

I made a file with my login and password - /etc/mail/authinfo/yandex-auth :

AuthInfo:smtp.yandex.ru "U:<My login>" "I:<email>" "P:<password>" "M:<login>"
AuthInfo:smtp.yandex.ru:587 "U:<My login>" "I:<email>" "P:<password>" "M:<login>"

And than:

makemap hash /etc/mail/authinfo/yandex-auth < /etc/mail/authinfo/yandex-auth

I set up Sendmail to send emails through an External SMTP Service (Yandex).

But I have got an error in my syslog:

Jun 11 19:00:45 kids-app-api-droplet sm-mta[7381]: STARTTLS=client, relay=smtp.yandex.ru., version=TLSv1.3, verify=FAIL, cipher=TLS_AES_256_GCM_SHA384, bits=256/256
Jun 11 19:00:45 kids-app-api-droplet sm-mta[7381]: 05BInLgB007204: AUTH=client, available mechanisms do not fulfill requirements
Jun 11 19:00:45 kids-app-api-droplet sm-mta[7381]: AUTH=client, relay=smtp.yandex.ru., temporary failure, connection abort
Jun 11 19:00:45 kids-app-api-droplet sm-mta[7381]: 05BInLgB007204: to=<lecharton@yandex.ru>, ctladdr=<root@childrengo.org> (0/0), delay=00:11:24, xdelay=00:00:00, mailer=relay, pri=300379, relay=smtp.yandex.ru. [<IP>], dsn=4.0.0, stat=Deferred: Temporary AUTH failure

I checked this https://www.digitalocean.com/community/tutorials/how-to-send-email-through-an-external-smtp-service-with-sendmail-on-freebsd-10-1 and this https://www.digitalocean.com/community/questions/ubuntu-14-04-lamp-installed-sendmail-fatal-error-when-i-sent-first-message It did not help.

  • I installed cyrus-sasl*
  • I have the TXT records for DMARC1, spf1 and DKIM for my domain.
  • I have tried different users to send email. And I checked the password. I also checked the user exists.

I also don’t see these errors in my mail.log and in mail.err

Do you have any idea how to fix it? Or may be how to debug it?

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello, @lecharton

Could you please confirm if you have installed he SASL package as mentioned in the first tutorial? Usually this error message can occur when the cyrus-sasl is missing. You can try to install it manually and then restart sendmail:

sudo apt-get install sasl2-bin

service saslauthd restart

service sendmail restart

and then try again to send the email using sendmail.

Hope this helps!

Regards,
Alex

  • Hi,

    It helped, thank you!

  • It still does not work, but at least I have got a new error :-D

    • Hello, @lecharton

      Can you please share the error message you’re currently receiving when you’re trying to deliver the message so we can check it?

      Regards,
      Alex

      • Hi,

        I had a problem with authorisation. It failed even if I was sure the login and password combination is right.

        In the end I find out a tricky thing. There is an application password which you can user to let some application to login to your mail from the yandex mail provider. But if you create a mail for your domain on yandex it cannot login through smtp with a password nor with an application password. It does not know which combination is ok and just return an error.
        So I removed an application password and everything works fine now. I hope this small trick also would useful for somebody.

        Thank you fro your help!

        • Hello, @lecharton

          I’m glad you’ve sorted this. Also thanks for sharing what the issue was and how you’ve managed to sort it! I believe other users can find this useful if they run in the same problem.

          Regards,
          Alex

Submit an Answer