Automaton
Automaton

Reputation: 23

How to direct the replies to a specific email address?

I am using python to auto-send an email in Outlook to a given person. What I would like to do is direct their replies to a specific email address.

I know that ReplyRecipients is a property of Mailitem, but this seems to be read-only.

Below is my current code.

import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = '[email protected]'
mail.Subject = 'Test email'
mail.Body = 'This is a test email'
mail.Send()

Upvotes: 1

Views: 579

Answers (2)

OBu
OBu

Reputation: 5167

I just had the same problem. Based on the answer of Eugene Astafiev, I just added

mail.ReplyRecipients.Add("[email protected]")

and this filled the "Reply-to" field in the e-mail header correctly.

Upvotes: 0

Eugene Astafiev
Eugene Astafiev

Reputation: 49397

The MailItem.ReplyRecipients property is read-only. But the property returns a Recipients collection that represents all the reply recipient objects for the Outlook item where you can add or remove recipients.

Set myItem = Application.CreateItem(olMailItem) 
 
Set myRecipient = myItem.ReplyRecipients.Add("Eugene Astafiev") 
 
myRecipient.Type = olCC

Upvotes: 2

Related Questions