String[] Sendto = File.ReadAllLines("SendTo.txt");
SmtpClient X = new SmtpClient("smtp.gmail.com", 587);
//X.UseDefaultCredentials = false;
NetworkCredential Auth = new NetworkCredential("Someone@gmail.com", "Plainttext password");
X.Credentials = Auth;
X.EnableSsl = true;
foreach (string recip in Sendto)
{
try
{
MailAddress from = new MailAddress("Someone@gmail.com");
MailAddress to = new MailAddress(recip);
MailMessage myMail = new MailMessage(from, to);
myMail.Priority = MailPriority.High;
myMail.Subject = "Your Test is Done";
myMail.SubjectEncoding =
myMail.BodyEncoding = System.Text.Encoding.UTF8;
myMail.IsBodyHtml = true;
X.Send(myMail);
}
catch (Exception ex)
{ Console.WriteLine(ex.Message); }
为什么这不起作用?我嗅探了流量,我确实收到了来自 smpt.google.com 的 dns 回复,但无法连接到远程服务器