string to = "這里填寫接收者的Email地址"; string from = "這里填寫發(fā)送者的Email地址"; string subject = "這里寫郵件的主題"; string body = @"這里寫郵件的內(nèi)容";
MailMessage message = new MailMessage(from, to, subject, body); //SmtpClient client = new SmtpClient("smtp.gmail.com", 465); SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.Credentials = new NetworkCredential("Gmail帳戶", "Gmail密碼"); client.EnableSsl = true;