SendMail Method
Sends a new email.
Syntax
Remarks
This method sends a new message. Use the Message* (excluding MessageInfo collection and Message) to set the fields of the message that will be sent. To add an attachment, use the MessageAttachments collection to add the attachment information. As a note, the relevant collection are not cleared after the method is called. It is recommend to do so after calling this method.
Example: Simple Email
office365.MessageSubject = "I saw a Tree"; office365.MessageImportance = "High"; office365.MessageBodyContentType = "TEXT"; office365.MessageBodyContent = "It was in my back yard initially. It was still there when I last checked."; office365.MessageTo = "TreeLookOut@gmail.com"; office365.SendMail(True);Example: HTML email with Attachments
office365.MessageSubject = "Subject"; office365.MessageBodyContentType = "html"; office365.MessageBodyContent = "<p>Body</p><img src='cid:test1'>"; office365.MessageTo = "email@example.com"; //Inline: OLAttachment attachment1 = new OLAttachment("test picture", "./test.png"); attachment1.IsInline = true; attachment1.ContentId = "test1"; office365.MessageAttachments.Add(attachment1); //Normal: OLAttachment attachment2 = new OLAttachment("test file", "./test.txt"); office365.MessageAttachments.Add(attachment2); office365.SendMail(true);