Ombi: Gmail SMTP unable to connect

Created on 19 Feb 2019  路  12Comments  路  Source: tidusjar/Ombi

Describe the bug
Sending emails via gmail smtp fails with "The SMTP server has unexpectedly disconnected."

To Reproduce
Steps to reproduce the behavior:

  1. Add email notification configuration:

    • Enable SMTP Authentication: ON

    • SMTP Host: smtp.gmail.com

    • SMTP Port: 465, 587 (have tried both, same result)

    • Email sender, username: gmail address

    • Password: app password (2fa enabled)

  2. Click test button, see error in logs

Expected behavior
Sent emails

Logs (Logs directory where Ombi is located)
2019-02-18 19:42:42.943 -05:00 [Error] Exception when attempting to send an email MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected. at MailKit.Net.Smtp.SmtpStream.ReadAheadAsync(Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpStream.ReadResponseAsync(Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpStream.ReadResponse(CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.SendCommandAsync(String command, Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.SendEhloAsync(Boolean ehlo, Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.EhloAsync(Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken) at Ombi.Notifications.GenericEmailProvider.SendAdHoc(NotificationMessage model, EmailNotificationSettings settings) in C:\projects\requestplex\src\Ombi.Notifications\GenericEmailProvider.cs:line 81 2019-02-18 19:42:42.946 -05:00 [Warning] Exception when testing Email Notifications MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected. at MailKit.Net.Smtp.SmtpStream.ReadAheadAsync(Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpStream.ReadResponseAsync(Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpStream.ReadResponse(CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.SendCommandAsync(String command, Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.SendEhloAsync(Boolean ehlo, Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.EhloAsync(Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken) at Ombi.Notifications.GenericEmailProvider.SendAdHoc(NotificationMessage model, EmailNotificationSettings settings) in C:\projects\requestplex\src\Ombi.Notifications\GenericEmailProvider.cs:line 81 at Ombi.Controllers.External.TesterController.Email(EmailNotificationSettings settings) in C:\projects\requestplex\src\Ombi\Controllers\External\TesterController.cs:line 225

Desktop (please complete the following information):

  • OS: Ubuntu 16.04

Ombi Version (please complete the following information):

  • Version 3.0.4248

Additional context
A different app on the same server is able to send mail via the same gmail account and settings. Tried every combination of the two ports (465, 587) and Disable TLS/SSL, Disable Certificate Checking options (just to see), same issue. Seems that it's not even getting to the point of authentication before the connection fails.

Most helpful comment

Fixed in develop, will push out a new release today

All 12 comments

Also further evidence that it's not even getting to the point of trying to authenticate, when I look at the app passwords usage on my gmail account, it shows the "last used" for the others, but the one I created specifically for Ombi has no usage.

I am having the same issue ever since updating to the latest release although I have noticed that email is working for some functions. Welcome messages are not working. When I go to settings > Notifications > Email > Test reports an error and doesn't send. New Requests and NewsLetter are working.

as of today, same problem here, cant authenticate

this has happended in this update 3.0.4248

And if you go to the previous version?

worked yesterday in previous version

Please provide your logs

When I try to send a test email from Settings > Notifications > Email I get the following logs.

2019-02-19 07:56:37.634 -06:00 [Error] Exception when attempting to send an email
MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected.
   at MailKit.Net.Smtp.SmtpStream.ReadAheadAsync(Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpStream.ReadResponseAsync(Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpStream.ReadResponse(CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.SendCommandAsync(String command, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.SendEhloAsync(Boolean ehlo, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.EhloAsync(Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
   at Ombi.Notifications.GenericEmailProvider.SendAdHoc(NotificationMessage model, EmailNotificationSettings settings) in C:\projects\requestplex\src\Ombi.Notifications\GenericEmailProvider.cs:line 81
2019-02-19 07:56:37.638 -06:00 [Warning] Exception when testing Email Notifications
MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected.
   at MailKit.Net.Smtp.SmtpStream.ReadAheadAsync(Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpStream.ReadResponseAsync(Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpStream.ReadResponse(CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.SendCommandAsync(String command, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.SendEhloAsync(Boolean ehlo, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.EhloAsync(Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
   at Ombi.Notifications.GenericEmailProvider.SendAdHoc(NotificationMessage model, EmailNotificationSettings settings) in C:\projects\requestplex\src\Ombi.Notifications\GenericEmailProvider.cs:line 81
   at Ombi.Controllers.External.TesterController.Email(EmailNotificationSettings settings) in C:\projects\requestplex\src\Ombi\Controllers\External\TesterController.cs:line 225

Yesterday I was able to send a test newsletter but today I am not. Here are the logs from that.

Update, Disregard this post. I am able to send test newsletters.

When I try and send a User Welcome email there are no log entries.

I just installed for the first time on v 3.0.4248 via the apt repo.

Tried increasing logging levels but I don't see anything more relevant in the output. My suspicion based on similar stuff found googling the MailKit error is that it's not setting SSL/TLS and the google server is rejecting it early on.

Fixed in develop, will push out a new release today

Fix works for me, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Alosander picture Alosander  路  5Comments

Handl3vogn picture Handl3vogn  路  4Comments

tidusjar picture tidusjar  路  5Comments

arm3n picture arm3n  路  3Comments

EricHupp picture EricHupp  路  4Comments