在asp.net中使用免费的SMTP服务器发送电子邮件的问题:嗨,我yogesh和我有一个问题,在使用免费的SMTP服务器发送电子邮件。
我有Windows 7的教授...(OS)。
WINDOWS7没有巡航能力的默认SMTP服务器安装...所以我必须做什么,请
给我一步一步安装SMTP服务器的例子,因为我已经尝试了许多选项
我也用Gmail服务器,但失败了。我还发现,Windows 7不再支持
SMTP服务器,以便做什么...我的代码,我只是想使用Gmail服务器是如下..
什么是错用此代码。string from = "imyogesh@mail.com"; // this is my gmail account
string to = "imyogesh@mail.com";
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from, "One Ghost" , System.Text.Encoding.UTF8);
mail.Subject = "This is a test mail" ;
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "This is Email Body Text";
mail.BodyEncoding = System.Text.Encoding.UTF8;
mail.IsBodyHtml = true ;
mail.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(from, "PASSWORD");
client.Port = 587; // Gmail works on this port
client.Host = "smtp.gmail.com";
client.EnableSsl = true; //Gmail works on Server Secured Layer
try
{
client.Send(mail);
}
catch (Exception ex)
{
Exception ex2 = ex;
string errorMessage = string.Empty;
while (ex2 != null)
{
errorMessage += ex2.ToString();
ex2 = ex2.InnerException;
}
HttpContext.Current.Response.Write(errorMessage );
}
我已经安装了IIS7 ...我不知道如何安装SMTP服务..
请帮助我,我m因为5天的尝试。我需要测试我的应用程序发送电子邮件。
由于Windows 7是不支持smtp服务器是什么,我必须做的。
此代码IAM得到错误。
{C}请建议我的解决方案....