3

I am trying to automate emails using python. Unfortunately, the network administrators at my work have blocked SMTP relay, so I cannot use that approach to send the emails (they are addressed externally).

I am therefore using win32com to automatically send these emails via outlook. This is working fine except for one thing. I want to choose the "FROM" field within my python code, but I simply cannot figure out how to do this.

Any insight would be greatly appreciated.

user2689931
  • 383
  • 1
  • 6
  • 15

1 Answers1

5

If you configured a separate POP3/SMTP account, set the MailItem.SendUsingAccount property to an account from the Namespace.Accounts collection.

If you are sending on behalf of an Exchange user, set the MailItem.SentOnBehalfOfName property

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78