用c#发邮件 从localhost
直接用smtp的设置,我把本机的smtp开通了,检测也成功,而且也relay了127.0.0.1但是用以下代码发送不成功 输出了success但是没有收到邮件 请教 谢谢
try
{
SmtpClient client = new SmtpClient("localhost", 25);
//client.UseDefaultCredentials = false;
//client.Credentials = new ("wanjames", "Wz610913");
//client.DeliveryMethod =
MailMessage mail = new MailMessage("123@, "123@, "try", "try");
//mail.From = new MailAddress("123@);
//mail.To.Add("123@);
//mail.Subject = "No Subject";
//mail.BodyEncoding = System.Text.Encoding.Default;
//mail.Body = "Try";
//mail.IsBodyHtml = true;
client.Send(mail);
Console.Write("Success");
}
catch (Exception ex)
{
Console.Write(ex.Message);
}