I have a program which emails pdf files out to users using Outlook
The problem is the pdf file is not being attached to the email but is contained in the document boy as plain/text data i.e.
name="Customers Vol and Val Weekly (Week 38).pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Customers Vol and Val Weekly (Week 38).pdf"
JVBERi0xLjIKJeLjz9MKNjQgMCBvYmoKPDwKL0xpbmVhcml6ZWQKMQovTwo2NgovSApbCiAgICAg
ICA1NTUKICAgICAgIDE4MwpdCi9MCiAgICAzMjI0NDcKL0UKICAgIDMxMTAxNwovTgoyCi9UCiAg
ICAzMjExMjMKPj4KZW5kb2JqCnhyZWYKNjQKMTMKMDAwMDAwMDAxNSAwMDAwMCBuDQowMDAwMDAw
NDg4IDAwMDAwIG4NCjAwMDAwMDA3MzggMDAwMDAgbg0KMDAwMDAwMDk1NiAwMDAwMCBuDQowMDAw
MDAxMTI0IDAwMDAwIG4NCjAwMDAwMDIyMzMgMDAwMDAgbg0KMDAwMDAwMjQ4MCAwMDAwMCBuDQow
MDAwMDAyNjQzIDAwMDAwIG4NCjAwMDAwMDM3NTAgMDAwMDAgbg0KMDAwMDAwMzk5MiAwMDAwMCBu
DQowMDAwMDA3Mzc0IDAwMDAwIG4NCjAwMDAxNTcwNDkgMDAwMDAgbg0KMDAwMDAwMDU1NSAwMDAw
if I email the same pdf document manually the file is attached correctly.
My Code is
Public objOutlook As Outlook.Application
Public objOutlookEmail As Outlook.MailItem
Public objOutlookAttachments As Outlook.Attachments
Public Sub SendEmail(ByVal strAttachment As String, strEmailTo As String, strSubject As String, strBody As String)
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookEmail = objOutlook.CreateItem(olMailItem)
objOutlookEmail.Subject = strSubject
objOutlookEmail.Body = strBody
objOutlookEmail.To = strEmailTo
Set objOutlookAttachments = objOutlookEmail.Attachments
If strAttachment <> "" Then
objOutlookAttachments.Add strAttachment
End If
objOutlookEmail.Send
Set objOutlook = Nothing
Set objOutlookEmail = Nothing
Set objOutlookAttachments = Nothing
End Sub
Any Suggestions would be greatl appreciated Gary Parker
Systems Support Analyst
The problem is the pdf file is not being attached to the email but is contained in the document boy as plain/text data i.e.
name="Customers Vol and Val Weekly (Week 38).pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Customers Vol and Val Weekly (Week 38).pdf"
JVBERi0xLjIKJeLjz9MKNjQgMCBvYmoKPDwKL0xpbmVhcml6ZWQKMQovTwo2NgovSApbCiAgICAg
ICA1NTUKICAgICAgIDE4MwpdCi9MCiAgICAzMjI0NDcKL0UKICAgIDMxMTAxNwovTgoyCi9UCiAg
ICAzMjExMjMKPj4KZW5kb2JqCnhyZWYKNjQKMTMKMDAwMDAwMDAxNSAwMDAwMCBuDQowMDAwMDAw
NDg4IDAwMDAwIG4NCjAwMDAwMDA3MzggMDAwMDAgbg0KMDAwMDAwMDk1NiAwMDAwMCBuDQowMDAw
MDAxMTI0IDAwMDAwIG4NCjAwMDAwMDIyMzMgMDAwMDAgbg0KMDAwMDAwMjQ4MCAwMDAwMCBuDQow
MDAwMDAyNjQzIDAwMDAwIG4NCjAwMDAwMDM3NTAgMDAwMDAgbg0KMDAwMDAwMzk5MiAwMDAwMCBu
DQowMDAwMDA3Mzc0IDAwMDAwIG4NCjAwMDAxNTcwNDkgMDAwMDAgbg0KMDAwMDAwMDU1NSAwMDAw
if I email the same pdf document manually the file is attached correctly.
My Code is
Public objOutlook As Outlook.Application
Public objOutlookEmail As Outlook.MailItem
Public objOutlookAttachments As Outlook.Attachments
Public Sub SendEmail(ByVal strAttachment As String, strEmailTo As String, strSubject As String, strBody As String)
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookEmail = objOutlook.CreateItem(olMailItem)
objOutlookEmail.Subject = strSubject
objOutlookEmail.Body = strBody
objOutlookEmail.To = strEmailTo
Set objOutlookAttachments = objOutlookEmail.Attachments
If strAttachment <> "" Then
objOutlookAttachments.Add strAttachment
End If
objOutlookEmail.Send
Set objOutlook = Nothing
Set objOutlookEmail = Nothing
Set objOutlookAttachments = Nothing
End Sub
Any Suggestions would be greatl appreciated Gary Parker
Systems Support Analyst