3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
C# SMTP寄送郵件加上附件檔案 資料來源:http://blog.xuite.net/chu.hsing/Think/33046869 using System; using System.Collections.Generic; using System.Text; using System.Net.Mail;// namespace SendMailTest {     class Program     {         static void Main(string[] args)         {             try             {                 SmtpClient sc = new SmtpClient(“ms14.hinet.net”);//                 sc.Port = 25;                 MailAddress receiverAddress = new MailAddress(“pan19819@ms14.hinet.net”, “潘建誌”);//                 MailAddress senderAddress = new MailAddress(“jacky@sysplus.com.tw”, “精創”);                 MailMessage mail = new MailMessage(senderAddress,receiverAddress);//                 mail.Subject=”test”;                 mail.Body = “yahoo”;                 mail.IsBodyHtml = true;//                                 Attachment attachment = new Attachment(@”C:\Test\JackyTest.zip”);//                                  mail.Attachments.Add(attachment);//                                  sc.Send(mail);//                 Console.WriteLine(“Done.”);             }             catch (Exception ex)             {                 Console.WriteLine(ex.Message);             }             Console.ReadLine();         }     } }    

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦