Hi,
for sending emails with attachment in Windows 7 through Outlook 2007 with MAPI control, I'm using this code:
In this resolved thread http://www.vbforums.com/showthread.php?t=605286 you can read, what was the problem with sending email in Windows 7.Code:If MAPISession1.SessionID <> 0 Then MAPISession1.SignOff End If MAPISession1.SignOn MAPIMessages1.SessionID = MAPISession1.SessionID MAPIMessages1.Compose MAPIMessages1.RecipAddress = "smtp: [email protected]" MAPIMessages1.RecipDisplayName = "smtp: [email protected]" MAPIMessages1.AddressResolveUI = True MAPIMessages1.MsgSubject = "My email with attachment" MAPIMessages1.AttachmentPathName = Path & "\" & name MAPIMessages1.MsgNoteText = "Hi there. " & Chr(10) _ & "Here are some pgp files for you!" MAPIMessages1.send False If MAPISession1.SessionID <> 0 Then MAPISession1.SignOff Else MsgBox "This email could not be send to recipient!" End If
With the code above I can send email with attachment without any error. But some recipients are reporting back to me, that email attachments (like file.pgp) are in wrong format or the files are not attached at all. Some of them have had attached only this file: Winmail.Dat.
I suspect Outlook for this weird behavior. Is something missing in my code or what in my code makes attachment in email corrupt?
Thanks in advance for any help![]()




Reply With Quote