如何使用asp.net发送邮件

时间:2014-06-24 12:20:33

标签: asp.net email

当客户购买商品时,该按钮应该向网站所有者发送电子邮件。这是我目前的代码:

 SmtpClient smtpClient = new SmtpClient("smtpout.europe.secureserver.net", 80);

        smtpClient.Credentials = new System.Net.NetworkCredential("info@furkantellioglu.com      ", "Password");
        smtpClient.UseDefaultCredentials = true;
        smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtpClient.EnableSsl = true;
        MailMessage mail = new MailMessage();
        mail.Body = "Bekleyen Siparişleriniz Bulunmakta Lütfen Kontrol Ediniz.";
        mail.Subject = "Dermabon Web Satış";
        mail.IsBodyHtml = true;

        mail.From = new MailAddress("info@furkantellioglu.com", "Sipariş");
        mail.To.Add(new MailAddress("info@furkantellioglu.com"));
        mail.CC.Add(new MailAddress("f.tellioglu@gmail.com"));

        smtpClient.Send(mail);

但是当我运行它时,我收到了这个错误:

An exception of type 'System.Net.Mail.SmtpException' occurred in System.dll but was not handled in user code

Additional information: Sunucu güvenli bağlantıları desteklemiyor.

关于这意味着什么想法?

3 个答案:

答案 0 :(得分:0)

错误消息表示服务器不支持安全连接。您正在使用enable ssl但发送到端口80,因此可能存在冲突。

答案 1 :(得分:0)

似乎是一个端口错误,请尝试使用更改 EnableSsl=false;和/或UseDefaultCredentials = true;或使用port 25

答案 2 :(得分:0)

请尝试更改

 smtpClient.EnableSsl = true;

SmtpServer.EnableSsl = false;

此论坛上讨论过一个类似的主题,可能对您有所帮助Link