Hello,Iam trying to send an email through outlook 2010 on a win 7 64 bit oswith
python 2.7 32 bit and win32com 32 bit. I am using the same codeexample found in
many Google search results. This chunk of code willrun fine if I rem out the
attachment, but once I try adding theattachment, I get an error about 'no data
source provided'. Thissame sample of code appears to work fine in many
instances, but I'vealso seen this error appear on the net since 2002. I've also
changedthe attachment line use this format, and have tried it myself, butno
luck#newMail.Attachments.Add('Location', olByValue, 1, 'Description')
I've named changed the name of the attachment every way possible (r'c:\test.txt
c:\test.txt c:\\test.txt) and I've placed it in other directories, but still
the same error.
Any suggestions
importwin32com.clientolMailItem = 0x0
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.Subject = "I AM SUBJECT!!"
newMail.Body = "I AM IN THE BODY\nSO AM I!!!"
newMail.To = "them...@mail.org"
#newMail.CC = "moreaddresses here"
#newMail.BCC = "aaa"
attachment1 = r'c:\test.txt'
newMail.Attachments.Add(attachment1)
newMail.Send()
pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft
Outlook', 'Cannot add the attachment; no data source was provided.',
None, 0, -2147352567), None)
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32