mdProgrammer
Programmer
I have code, found on the Internet, which can send an email to gmail (via an internal relay). How do I add an attachment of a report in the database? I can't use Outlook (I have code for this that has worked for years, but we're no longer using Outlook) due to switching to web-based email, and much of the report attachment code I've found uses MS Outlook.
I also had a 2nd question similar to this issue (of outlook). Is it possible to change what email program is used when clicking on an email field? (i.e., when I click on an email in a table, it'll open up MS Outlook. This will no longer be the case).
Code:
Dim sMailServer
Dim sMailFromAddress
Dim sMailToAddress
Dim sMailAttachment As Attachment
Dim sSubject
Dim sBody
Dim sToAddress
sMailServer = SMTPServer
sMailFromAddress = fromEmail
sMailToAddress = ToEmail
Dim ObjMessage
Set ObjMessage = CreateObject("CDO.Message")
sToAddress = sMailToAddress
sSubject = "Subject"
sBody = "MailBody"
ObjMessage.Subject = sSubject
ObjMessage.FROM = sMailFromAddress
ObjMessage.To = sToAddress
'ObjMessage.cc = sCCAddress
ObjMessage.TextBody = sBody
[COLOR=#4E9A06]' Would like to attach a report from Access[/color][COLOR=#EF2929]ObjMessage.addattachment "file://c:\TestImage.jpg"[/color]
ObjMessage.configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
ObjMessage.configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = sMailServer
ObjMessage.configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
ObjMessage.configuration.Fields.Update
ObjMessage.Send
I also had a 2nd question similar to this issue (of outlook). Is it possible to change what email program is used when clicking on an email field? (i.e., when I click on an email in a table, it'll open up MS Outlook. This will no longer be the case).