Dnn.Platform: TimeOut when testing host SMTP parameters on SSL

Description of bug

Using SMTP connection on port 465 with SSL and testing the specified parameters always results to a Timeout if target host only supports implicit SSL.

Steps to reproduce

Just try using the following parameters and test to see a timeout: host: smtps.aruba.it:465 enable ssl: on smtp username: set at any value, test will never get to the point of using it smpt password: set at any value, test will never get to the point of using it smtp authentication: basic

Current behavior

Test hangs until a timeout occurs.

Expected behavior

A proper connection and a successfull send of the test email.

Error information

Test will add the following error messate to the EventLog: AbsoluteURL:/API/PersonaBar/ServerSettingsSmtpHost/SendTestEmail DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke ExceptionGUID:c74b358f-b88b-49cc-87e1-2132543fb65a AssemblyVersion: PortalId:-1 UserId:-1 TabId:-1 RawUrl: Referrer: UserAgent: ExceptionHash:YtkkCJ66Rwp9mcQRpSQZr7zQ+MI= Message:The operation has timed out. StackTrace: at System.Net.Mail.SmtpClient.Send(MailMessage message) at DotNetNuke.Services.Mail.Mail.SendMailInternal(MailMessage mailMessage, String subject, String body, MailPriority priority, MailFormat bodyFormat, Encoding bodyEncoding, IEnumerable`1 attachments, String smtpServer, String smtpAuthentication, String smtpUsername, String smtpPassword, Boolean smtpEnableSSL) InnerMessage: InnerStackTrace: Source:System FileName: FileLineNumber:0 FileColumnNumber:0 Method: Server Name: XXXXXX

Additional context

The timeout error is caused by this library: System.Net.Mail. According to this post (http://www.systemnetmail.com/faq/5.3.aspx) this library only supports explicit SSL, that is it expects port 25 to be open so that it can send a start TLS on it and switch to port 465 then after. If port 25 is not open, the library times out. This is not a bug of DNN in itself, but because it is using a System DLL that does not support implicit SSL (directly starting with encryption), it makes impossible to use it with providers like Aruba (in Italy one of the biggest providers of internet services and cloud solutions) that expects the use of implicit SMTP on their SMTP service.

Affected version

  • [ X] 10.00.00 alpha build
  • [ X] 09.06.01 release candidate
  • [ X] 09.06.00 latest supported release

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (17 by maintainers)

Most upvoted comments

We’ll start dev on moving it to provider model.

Do we have consensus to move to MailKit or should we just keep core functionality for now and move to provider model and then implement MailKit at a later date?

AFAIK MailKit is the library that’s typically recommended. That said, it would be nice to make email sent via a provider, so that folks who use a mail service like SendGrid can send email using their API instead of just over SMTP, if they want. But I’d accept an upgrade to MailKit by itself, if that change came in.

I’ve submitted a pull request for CoreMailProvider with existing functionality for now. I’ll follow up with another pull request migrating from System.Net.Mail to MailKit.

The core is open source, pull requests are welcome if you are a developer.