private void Button1_Click(object sender, System.EventArgs e) { MailMessage mail = new MailMessage(); mail.To = "[email protected]"; mail.From = "[email protected]"; yourcompany换成你本地的服务器的名字,或者是你的域名。 mail.Subject = "this is a test email."; mail.Body = "this is my test email body"; //SmtpMail.SmtpServer = "localhost"; //your real server goes here 这句完全可以去掉,默认是本地的如果本地不可用,自动寻找网络上可用的只能服务器。 SmtpMail.Send( mail );
to zhanqiangz: private void Button1_Click(object sender, System.EventArgs e) { MailMessage mail = new MailMessage(); mail.To = "[email protected]"; //mail.From = "[email protected]"; mail.From = "[email protected]"; yourcompany换成你本地的服务器的名字,或者是你的域名。我的默认的smpt虚拟服务器>>域名>>cyg ,因此我改为 mail.From = "[email protected]"; 可还是发不出去呀! mail.Subject = "this is a test email."; mail.Body = "this is my test email body"; //SmtpMail.SmtpServer = "localhost"; //your real server goes here 这句完全可以去掉,默认是本地的如果本地不可用,自动寻找网络上可用的只能服务器。 >>>次句我已删了! SmtpMail.Send( mail );
{
MailMessage mail = new MailMessage();
mail.To = "[email protected]";
mail.From = "[email protected]";
yourcompany换成你本地的服务器的名字,或者是你的域名。
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
//SmtpMail.SmtpServer = "localhost"; //your real server goes here 这句完全可以去掉,默认是本地的如果本地不可用,自动寻找网络上可用的只能服务器。
SmtpMail.Send( mail );
private void Button1_Click(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "[email protected]";
//mail.From = "[email protected]";
mail.From = "[email protected]";
yourcompany换成你本地的服务器的名字,或者是你的域名。我的默认的smpt虚拟服务器>>域名>>cyg ,因此我改为 mail.From = "[email protected]"; 可还是发不出去呀!
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
//SmtpMail.SmtpServer = "localhost"; //your real server goes here 这句完全可以去掉,默认是本地的如果本地不可用,自动寻找网络上可用的只能服务器。 >>>次句我已删了!
SmtpMail.Send( mail );