Contributions
Re: Adding an attachment to an email sent via CDO
Yes, the extension on the receiving end is incorrect. Afterfurther research, I've discovered that the content type of the attachment is incorrect which makes the email clients think the file extension is incorrect thus changing it. To alter my question, how can I send the attachment with the correct content-type? My attempts at doing this are outlined in the link above.3.3KViews0likes0CommentsRe: How do I send the MHTML or HTML results as the body of an email.
I'd delete this post if I could figure out how. I've realized that the MHTML file that is exported with Log.SaveResultsAs (which is what I want to send as the body) extensively uses JavaScript. Most mail clients don't seem to allow that.904Views1like0CommentsAdding an attachment to an email sent via CDO
I followed the instructions in this example to send an email via CDO, but when I add an attachment, the file extension is changed. Does anybody know why it does this and/or how this can be avoided? Here is my code. Sub SendResults() WorkingDirectory = Project.ConfigPath & "Log\ExportedResults\" FileName = WorkingDirectory & "Log.mht" Log.SaveResultsAs FileName, 2 Call SendEmail("example@example.com", "example@commandalkon.com", "Test Results", ProjectSuite.Variables.EmailBody, FileName) End Sub Function SendEmail(FromAddress, ToAddress, Subject, Body, Attachment) Call Err.Clear On Error Resume Next Schema = "http://schemas.microsoft.com/cdo/configuration/" Set Config = Sys.OleObject("CDO.Configuration") Config.Fields.Item(Schema + "sendusing") = 2 Config.Fields.Item(Schema + "smtpserver") = "SMTPSERVER" Config.Fields.Item(Schema + "smtpserverport") = 25 Config.Fields.Item(Schema + "smtpauthenticate") = 1 ' Config.Fields.Item(schema + "sendusername") = "" ' Config.Fields.Item(schema + "sendpassword") = "" Call Config.Fields.Update Set Message = Sys.OleObject("CDO.Message") Set Message.Configuration = Config Message.From = FromAddress Message.To = ToAddress Message.Subject = Subject Message.HTMLBody = Body Call Message.AddAttachment(Attachment) Call Message.Send If Err.Number = 0 Then SendEmail = True Else Call Log.Error("Email could not be sent.", Err.Description) End If End Function14KViews0likes3CommentsHow do I send the MHTML or HTML results as the body of an email.
I've followed the directions as per these instructions. I am able to receive the email and set the body to plain text, but I can't figure out how to make the body of the email the same as the MHTML file (or HTML file). I've tried the CDO.Message.CreateMHTMLBody method with the HTM file to no avail.5.8KViews0likes2Comments