Home Mail functionality fails when TLS(Transport Layer Security) is turned off
Reply: 0

Mail functionality fails when TLS(Transport Layer Security) is turned off

user337986
1#
user337986 Published in 2017-12-07 15:42:00Z

I am working on windows application. We are using TLS for security in our project. Not sure what is TLS. I later googled and came to know its something to do with security in networking department. We have a email functionality in the application that I work on. Like when a generate a file a notification mail goes to list of recipients. Recently TLS was turned off by network team in UAT and that affected the email functionality. Mails were not generating. Later TLS was turned on and the email functionality worked fine. Now the requirement is that the TLS will be turned off for 2 months in production due to some reasons and by doing that email functionality shouldn't get affected. Below is the code where SMTP class is used. public static bool SendMail(MailMessage mail, int attemptCount) { SmtpClient smtpMail = new SmtpClient(); // Handles the sending of an email

        try
        {
            smtpMail.Host = Properties.Settings.Default.ExchangeServer;
            smtpMail.DeliveryMethod = SmtpDeliveryMethod.Network;

            smtpMail.Send(mail);
        }
        catch (SmtpException ex)
        {
            if (ex.StatusCode == SmtpStatusCode.InsufficientStorage)
            {
                if (attemptCount > 25)
                {
                    exceptions.MOMException.SendExceptionMail(ex, mail.From.DisplayName + " - " + mail.From.Address);
                    return false;
                }
                attemptCount++;
                return SendMail(mail, attemptCount);
            }
            else
            {
                exceptions.MOMException.SendExceptionMail(ex, mail.From.DisplayName + " - " + mail.From.Address);
                return false;
            }
        }
        catch (Exception ex)
        {
            exceptions.MOMException.SendExceptionMail(ex, mail.From.DisplayName + " - " + mail.From.Address);
            return false;
        }
        return true;
    }

I didn't understand how TLS is affecting email functionality. Someone please help in solving this issue so that emails are generated no matter TLS is turned on or off.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.374383 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO