-
Notifications
You must be signed in to change notification settings - Fork 73
Send Attachment
Gautam Singh edited this page Mar 13, 2016
·
1 revision
var exch = new ExchangeService(ExchangeVersion.Exchange2013);
exch.Credentials = new ExchangeCredentials(credentials.userName, credentials.password);
exch.Url = new Uri("https://outlook.office365.com/Ews/Exchange.asmx");
EwsLogging.DebugLogEnabled = true; // false to turnoff debugging.
var msgattach = new EmailMessage(exch);
msgattach.Subject = "Dentist Appointment";
msgattach.Body = new MessageBody("The appointment is with Dr. Smith.");
msgattach.ToRecipients.Add("[email protected]")
var file = msgattach.Attachments.AddFileAttachment("filename to attach.txt", "c29tZSB0ZXh0");
/** AddFileAttachment parameters -
* filename (name of attachment as shown in outlook/owa not actual file from disk),
* base64 content of file (read file from disk and convert to base64 yourself)
*/
msgattach.Send().then(() => {
console.log("------------");
}, (ei) => {
console.log(ei.stack, ei.stack.split("\n"));
console.log("------------");
});