Я пытался отправить email
с помощью gmail account
на asp.net C#, но я получаю эту ошибку:отправка электронной почты (Gmail) в asp.net
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [2607:f8b0:400c:c01::6c]:587
Я пробовал различные коды из различных ресурсов, но ни один из них не работал с моим проектом более я попробовал эти шаги, но по-прежнему не работает:
- пытающиеся порты 25, 465, 587 на обоих VS 2012 сервере и локальном хосте (IIS 7).
- Брандмауэр выключен, установлен антивирус.
- запуск визуальной студии как администратор.
Возможно, кто-нибудь скажет мне, в чем причина этой ошибки. и если есть возможность изменить что-то, где я должен начать ..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default6 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var myMailMessage = new System.Net.Mail.MailMessage();
myMailMessage.From = new System.Net.Mail.MailAddress("[email protected]");
myMailMessage.To.Add("[email protected]");// Mail would be sent to this address
myMailMessage.Subject = "Feedback Form";
myMailMessage.Body = "Hello";
var smtpServer = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtpServer.Port =587;
smtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "**YOURPASSWORD**");
smtpServer.EnableSsl = true;
smtpServer.Send(MyMailMessage);
Response.Redirect("Default.aspx");
}
}
Покажите нам код, пожалуйста –
возможно дубликат [Отправка электронной почты в .NET через Gmail] (http://stackoverflow.com/questions/32260/sending-email-in-net-through-gmail) – Charlino
Я использовал этот, но все еще не работает :( – reaz