我在用戶填寫在線表單時使用以下方式在c#.NET中發送電子郵件。 我在想,線程對於我所擁有的是否是必需的。c#發送電子郵件消息線程
MailAddress From = new MailAddress("[email protected]");
MailAddress To = new MailAddress(toemail);
MailMessage alert = new MailMessage(From, To);
alert.Subject = "Registration for " + name;
alert.Body = bodyText;
alert.IsBodyHtml = true;
NetworkCredential creds = new NetworkCredential("[email protected]", "Xfdfdfd");
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.EnableSsl = true;
client.Credentials = creds;
client.Send(alert);
在此先感謝
你的意思是「穿線」? – bluevector
答:這取決於。 – SLaks