Get Recipient address, Mail Content and Attachment

C

Cherry

I want to add a button in the toolbar, after a user finish
compose a mail, by click this toolbar button, it will
retrieve the recipient email address, Mail subject, Mail
content and the path of the attachment, it is possible to
get these information from a currently composing mail??

Do anyone have any idea how to get these information ??

Many Thanks
Cherry
 
E

Eric Legault [MVP - Outlook]

Yes, this is definitely possible. The below procedure should give you an
idea of what you can access:

Sub GetEmailProperties()
Dim objMessage As Outlook.MailItem

Set objMessage = ActiveInspector.CurrentItem 'GETS THE CURRENTLY OPEN
NEW MESSAGE
Debug.Print objMessage.Recipients.Item(1).Address
Debug.Print objMessage.Subject
Debug.Print objMessage.Body
Debug.Print objMessage.Attachments.Item(1).FileName
'NOTE: you cannot access the path of the attachment, since it is no
longer 'relevant' after it is attached to the message.
'However, the PathName property gives you the full path for linked
(embedded) files
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top