0
我正在創建一個看起來像這樣的偶數附件。如何將附件添加到使用API方法發送的電子郵件電子郵件
string schLocation = "Conference Room";
string schSubject = "Business visit discussion";
string schDescription = "Schedule description";
System.DateTime schBeginDate = Convert.ToDateTime("7/3/2008 10:00:00 PM");
System.DateTime schEndDate = Convert.ToDateTime("7/3/2008 11:00:00 PM");
//PUTTING THE MEETING DETAILS INTO AN ARRAY OF STRING
String[] contents = { "BEGIN:VCALENDAR",
"PRODID:-//Flo Inc.//FloSoft//EN",
"BEGIN:VEVENT",
"DTSTART:" + schBeginDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"),
"DTEND:" + schEndDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"),
"LOCATION:" + schLocation,
"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" + schDescription,
"SUMMARY:" + schSubject, "PRIORITY:3",
"END:VEVENT", "END:VCALENDAR" };
/*THE METHOD 'WriteAllLines' CREATES A FILE IN THE SPECIFIED PATH WITH
THE SPECIFIED NAME,WRITES THE ARRAY OF CONTENTS INTO THE FILE AND CLOSES THE
FILE.SUPPOSE THE FILE ALREADY EXISTS IN THE SPECIFIED LOCATION,THE CONTENTS
IN THE FILE ARE OVERWRITTEN*/
System.IO.File.WriteAllLines(Server.MapPath("Sample.ics"), contents);
//METHOD TO SEND EMAIL IS CALLED
// SendMail();
//System.Net.Mail.Attachment mailAttachment = new Attachment(Server.MapPath("Sample.ics"));
}
現在我想給未使用的smtp但像HttpBasicAuthenticator
API方法我如何在SMTP這個方法來發送附件通過電子郵件附件的庫Attachment
什麼是API使用?
'System.Net.Mail'將通過已配置的服務器詳細信息發送,但協議實際上被卡在使用這些對象的SMTP上,據我所知。如果你需要通過HTTP發送電子郵件,那麼它完全取決於API的實現,至於如何做到這一點 – DiskJunky
哦,所以附件只限於system.net.mail呵呵好吧,等一下,我會把我的代碼結束電子郵件我如何通過API發送它 –