2011年9月22日 星期四

簡易寄信程式

string mail_to = "xxx";//逗號做區隔
string mail_subject = "xxx";
string mail_from = "xxx";
string smtpServer = "xxx";
string mail_body = "xxx";
       System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
       message.From = new System.Net.Mail.MailAddress(mail_from);
       message.To.Add(new System.Net.Mail.MailAddress(mail_to));
       message.Subject = mail_subject;
       message.Body = mail_body;
       message.IsBodyHtml = true;
       System.Net.Mail.SmtpClient emailClient = new System.Net.Mail.SmtpClient(smtpServer);
       emailClient.Send(message);

沒有留言:

張貼留言