Experts Exchange connects you with the people and services you need so you can get back to work.
Your question, your audience. Choose who sees your identity—and your question—with question security.
Public MySMTP As New SMTPClient
Public MyPop3 As New POP3Client
' SHOULD YOU REQUIRE A PARAMETER FOR YOUR REPORT
.ParameterFields(1).AddCurrentValue Str(YOUR PARAMETER)
.ExportOptions.PDFExportAllPages = True
.ExportOptions.DestinationType = crEDTDiskFile
.ExportOptions.DiskFileName = "YourFilePath\" & sYourFileName & ".pdf"
.ExportOptions.FormatType = crEFTPortableDocFormat
.DisplayProgressDialog = False
Dim MyMsg As New CSMAILLib.MESSAGE
MyMsg.Subject = sSubject
MyMsg.To(1) = sRecipient
MyMsg.From(1) = sSender
' SHOULD YOU HAVE CC OR BCC IN YOUR MAIL
MyMsg.CC(1) = sCC
MyMsg.bCC(1) = sBCC
Dim sSection As CSMAILLib.Section
MyMsg.Sections(1).Body = Trim(sBody)
Set sSection = MyMsg.Sections.Add
sSection.AttachBodyFromFile ("YourFilePath\" & sYourFileName & ".pdf")
' for some exchange servers the user and pass are not required
MySMTP.ConnectESMTP sSMTPServer, "", "", "", sSMTPPort ' For Exchange 2010
' else use a user pass for a mail server
MySMTP.ConnectESMTP sSMTPServer, sPOP3User, sPOP3Pass, sPop3Login, sSMTPPort
' when you are done it does not hurt to kill the file afterwards to keep things clean
Kill ("YourFilePath\" & sYourFileName & ".pdf")
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $151.20.
Premium members get this course for $329.00.
Premium members get this course for $31.25.
Premium members get this course for $159.20.
Premium members get this course for $389.00.
Premium members get this course for $37.50.