How do you extract email addresses from the ‘To’ field in outlook?

Check out the Recipients collection object for your mail item, which should allow you to get the address: http://msdn.microsoft.com/en-us/library/office/ff868695.aspx Update 8/10/2017 Looking back on this answer, I realized I did a bad thing by only linking somewhere and not providing a bit more info. Here’s a code snippet from that MSDN link above, showing how … Read more

Send Outlook Email Via Python?

import win32com.client as win32 outlook = win32.Dispatch(‘outlook.application’) mail = outlook.CreateItem(0) mail.To = ‘To address’ mail.Subject=”Message subject” mail.Body = ‘Message body’ mail.HTMLBody = ‘<h2>HTML Message body</h2>’ #this field is optional # To attach a file to the email (optional): attachment = “Path to the attachment” mail.Attachments.Add(attachment) mail.Send() Will use your local outlook account to send. Note … Read more

Outlook Reply or ReplyAll to an Email

To simply Reply or ReplyAll selected messages try the following. Option Explicit Sub ReplyMSG() Dim olItem As Outlook.MailItem Dim olReply As MailItem ‘ Reply Dim olRecip As Recipient ‘ Add Recipient For Each olItem In Application.ActiveExplorer.Selection Set olReply = olItem.ReplyAll Set olRecip = olReply.Recipients.Add(“Email Address Here”) ‘ Recipient Address olRecip.Type = olCC olReply.HTMLBody = “Hello, … Read more

How to add an attachment to an email using VBA in Excel

Try this: Sub emailtest() Dim objOutlook As Object Dim objMail As Object Dim rngTo As Range Dim rngSubject As Range Dim rngBody As Range Set objOutlook = CreateObject(“Outlook.Application”) Set objMail = objOutlook.CreateItem(0) With ActiveSheet Set rngTo = .Range(“E2”) Set rngSubject = .Range(“E3”) Set rngBody = .Range(“E4”) End With With objMail .To = rngTo.Value .Subject = … Read more

Including Pictures in an Outlook Email

First of all, you are setting the plain text MailItem.Body property. Secondly, create an attachment and set the PR_ATTACH_CONTENT_ID property (DASL name “http://schemas.microsoft.com/mapi/proptag/0x3712001F”) using Attachment.PropertyAccessor.SetProperty. Your HTML body (MailItem.HTMLBody property) would then need to reference that image attachment through the cid attribute: <img src=”cid:xyz”> where xyz is the value of the PR_ATTACH_CONTENT_ID property. Look at … Read more

tech