我收到此错误,
Send Email Failed.Mailbox unavailable. The server response was: 5.7.1
Unable to relay for myEmail@itaxsmart.com
在此之前,我使用 godeady 进行数据库和发布站点。此代码工作之前,现在我已经转移并在我的Database
站点上发布了我的站点,Dedicated server
并且我无法从服务器的 IP 错误中重播
我收到此错误,
Send Email Failed.Mailbox unavailable. The server response was: 5.7.1
Unable to relay for myEmail@itaxsmart.com
在此之前,我使用 godeady 进行数据库和发布站点。此代码工作之前,现在我已经转移并在我的Database
站点上发布了我的站点,Dedicated server
并且我无法从服务器的 IP 错误中重播
注意: system.net.mail 命名空间用于发送电子邮件。
protected void btnsubmit_Click(object sender, ImageClickEventArgs e)
{
//Code for send Email
MailMessage sendMailforSA = new MailMessage();
SmtpClient smtpforSA = new SmtpClient();
string subjectforSA = null;
subjectforSA = "Thanks for apply";
System.Net.NetworkCredential credforSA = new System.Net.NetworkCredential("Superman@gmail.com", "password");
sendMailforSA.To.Add(txtemailid.Value);
MailAddress cc = new MailAddress("info@superman.com");
sendMailforSA.CC.Add(cc);
// sendMailforSA.CC("abcxxx@gmail.com");
sendMailforSA.From = new MailAddress("Rajnikant@gmail.com");
sendMailforSA.Subject = subjectforSA.ToString();
sendMailforSA.Body =" Thank you.... your message you can use html tag for style effect";
sendMailforSA.IsBodyHtml = true;
smtpforSA.Host = "smtp.gmail.com";
smtpforSA.Port = 25;
smtpforSA.EnableSsl = false;
smtpforSA.UseDefaultCredentials = false;
smtpforSA.Credentials = credforSA;
smtpforSA.Send(sendMailforSA);
}
http://satindersinght.blogspot.in/2012/01/how-to-send-email-in-asp.html
复制以下代码..它适用于我的 gmail 帐户
在 web.config 中
<mailSettings>
<smtp from="youremail@gmail.com">
<network host="smtp.gmail.com" port="587" userName="youremail" password="xx" defaultCredentials="false"/>
</smtp>
</mailSettings>
在后面的代码中(点击按钮)
Dim smtp As New System.Net.Mail.SmtpClient()
Dim smail As New System.Net.Mail.MailMessage
smail.To.Add(New System.Net.Mail.MailAddress("emailtowhomyouwanttosend@yahoo.com "))
smail.From = New System.Net.Mail.MailAddress("youremail@gmail.com", "Visit me")
smail.Subject = "hiii"
smail.IsBodyHtml = "true"
smail.Body = "HELLO THERE"
smtp.EnableSsl = True
smtp.Send(smail)
它肯定会工作..