This project is read-only.

TLS on port 25?

Oct 20, 2015 at 6:58 PM
I tried TLS on port 25 and it does not work - not sending STARTTLS.
how could it be done because I have a server that uses TLS on port 25 - I know it is odd, but that is as it is.

Any idea?
Oct 28, 2015 at 2:26 PM

Please show me more detail with sample code.
I'll investigate your problem.
Oct 28, 2015 at 5:52 PM

I am using this method:

public static SendMailResult SendEmailMessage(string fromEmail, string toEmail, string cc, string bcc, string subject, string body, string htmlBody, IEnumerable<string> attachments, string userName, string smtpServer, int smtpPort, string password, bool ssl, bool tls, bool spa, bool NoAuthentication)
        if (ssl && tls)
            throw new ArgumentException("SSL si TLS nu pot fi bifate in acelasi timp. Seteaza SSL=true sau TLS=true sau amandoua false.");

        if (spa && NoAuthentication)
            throw new ArgumentException("SPA si 'Fara autentificare' nu pot fi bifate in acelasi timp. Seteaza SPA=true sau 'Fara autentificare'=true sau amandoua false.");

        if (string.IsNullOrWhiteSpace(fromEmail))
            throw new ArgumentException("fromEmail cannot be null or empty", "fromEmail");

        if (string.IsNullOrWhiteSpace(toEmail))
            throw new ArgumentException("toEmail cannot be null or empty", "toEmail");

        if (string.IsNullOrWhiteSpace(subject) && string.IsNullOrWhiteSpace(body) && string.IsNullOrWhiteSpace(htmlBody))
            throw new ArgumentException("subject, body, htmlBody is empty");

        using (HigLabo.Net.Smtp.SmtpClient client = NoAuthentication ? new HigLabo.Net.Smtp.SmtpClient() : new HigLabo.Net.Smtp.SmtpClient(smtpServer, smtpPort, userName, password))
            if (NoAuthentication)
                client.ServerName = smtpServer;
                client.Port = smtpPort;

            if (tls)
                client.EncryptedCommunication = SmtpEncryptedCommunication.Tls;
            else if (ssl)
                client.EncryptedCommunication = SmtpEncryptedCommunication.Ssl;
                client.EncryptedCommunication = SmtpEncryptedCommunication.None;

            client.AuthenticateMode = NoAuthentication ? SmtpAuthenticateMode.None : (spa ? SmtpAuthenticateMode.Login : SmtpAuthenticateMode.Auto);

            var msg = new SmtpMessage(fromEmail, toEmail, cc ?? "", subject ?? "", body ?? "");
            if (!string.IsNullOrWhiteSpace(bcc))
                msg.Bcc.Add(new HigLabo.Mime.MailAddress(bcc));

            htmlBody = AnalyzeAndAlterMessageForEmbeddedImages(htmlBody);
            if (string.IsNullOrEmpty(body) && !string.IsNullOrEmpty(htmlBody))
            else if (!string.IsNullOrEmpty(body) && !string.IsNullOrEmpty(htmlBody))
                msg.SetBodyAsAlternativeContent(body, htmlBody);

            var res = client.SendMail(msg);

            return res;
Nov 5, 2015 at 10:36 AM
Any news?
Nov 13, 2015 at 7:07 AM

I could not reproduct your problem.
Could you show me SendMailResult object message?

And please check your network settings.
Port 25(or other) is opened?
Is AuthenticateMode correct?

Or see this document.

Nov 21, 2015 at 12:04 PM
Hi, port 25 is opened. Settings are correct. I tested with Outlook and it works correctly.
The problem is that when you set higlabo on TLS with port 25 it does not send STARTTLS command.
Your feedback will be golden.
Dec 19, 2015 at 12:33 PM

I'll investigate your problem.
Please wait for a few days.