简体   繁体   中英

How to resolve the “Server does not support secure connections” while sending mails from remote server

I am getting below error while sending mails from my webpage.

"Server does not support secure connections"

Please let me know how to resolve this error.My mail sending code is.Please let me know what are the possible troubleshooting ways.

public void sendmail(string emailaddress, string batchid)
{
    try
    {


        string msg1 = string.Empty;

        string mailLink = @"http://tk5sdatweb02:2222/SitePages/Sales%20Desk%20Request%20A%20Service.aspx?MBUP=Yes&BatchID= "+batchid;

        string strSubject = "Sales Desk Internal Bulk Upload";

        string msg2 = string.Empty;


        msg1 = "Test Email for" +batchid;

            msg1 = "<html><head><body>";
            msg2 = "<span style='font-size:14px;font-family:Calibri;'>Hi REDMOND\\v-rejinn";
            msg2 = msg2 + @"<br/><br/><span style='font-size:14px;font-family:Calibri;'>A target list has recently been uploaded they will be send to SDAT.<br/>";

            msg2 = msg2 + @"To view and/or validate the accounts, please visit the <a href='" + mailLink + "' style='color:#0000FF;text-decoration:none;'>MBUP Page</a><br />";
            msg2 = msg2 + "If you have any questions or issues, please reach out to <a href='mailto:SDPET@microsoft.com'>SDPET@microsoft.com</a>.<br />";
            msg2 = msg2 + "<br/>&nbsp;Thank you,<br/><b><font style='font-family:Segoe UI;font-size:28px;color:#033570;'>&nbsp;SALES</font>";
            msg2 = msg2 + "<font style='font-family:Segoe UI;font-size:28px;color:#7ac366;'> DESK</font></b><br />";
            msg2 = msg2 + "<font style='font-family:Segoe UI;font-size:10px;color:#3f6692;'>&nbsp;&nbsp;&nbsp;&nbsp;<span style='padding-left:11px;'>Enabling World Class Selling</span></font>";
            msg2 = msg2 + "</span></body></head></html>";

        //SmtpClient smtpClient = new SmtpClient();
        SmtpClient smtpClient = new SmtpClient("tk5sdatsql01", 25);
        //smtpClient.Host = "smtp.gmail.com";
        MailMessage message = new MailMessage();
        //MailAddress fromAddress = new MailAddress("sarath.hits@gmail.com", strSubject);
        MailAddress fromAddress = new MailAddress("sdmail@microsoft.com");
        message.From = fromAddress;
        string strmailid = string.Empty;
        strmailid = emailaddress;
        message.To.Add(strmailid);
        //message.Bcc.Add("sarath.psnr@gmail.com");
        message.Subject = strSubject;
        message.Body = msg2;
        message.IsBodyHtml = true;
        smtpClient.UseDefaultCredentials = false;
        smtpClient.Port = 25;
        //smtpClient.Credentials = new System.Net.NetworkCredential("sarath.hits@gmail.com", "myaccountdata");
        smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
        smtpClient.EnableSsl = false;
        smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtpClient.Send(message);

        Response.Write("success");
    }
    catch (WebException ex)
    {


    }
}

我认为PORT NO或凭据似乎是一个问题,请验证PORTNO。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM