我使用iis默认的smtp服务,但是在.net中却发不出邮件。邮件都到\mailroot\Badmail目录中了。 这是我发送邮件的代码,请问该怎么写 MailMessage mail = new MailMessage(); mail.To = TextBox1.Text; mail.From = "[email protected]"; mail.Subject = "this is a test email."; mail.Body = "Some text goes here"; SmtpMail.SmtpServer = "enginge"; //我在这里写的smtp中的domain name try { SmtpMail.Send( mail ); } catch(Exception er) { throw new Exception(er.Message); }
这是我发送邮件的代码,请问该怎么写
MailMessage mail = new MailMessage();
mail.To = TextBox1.Text;
mail.From = "[email protected]";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
SmtpMail.SmtpServer = "enginge"; //我在这里写的smtp中的domain name
try
{
SmtpMail.Send( mail );
}
catch(Exception er)
{
throw new Exception(er.Message);
}