我正在创建一个看起来像这样的偶数附件。
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,而是使用 API 方法,例如HttpBasicAuthenticator
我如何在 smtp 中以这种方法发送附件,它Attachment
是 API 中使用的库?