Reputation: 1108
currently I am using the win32com.client way of sending emails via Python 3, as I do not have access to SMTP. My code is below for reference:
def send_email(recipient, content, cc):
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
mail.Subject = content[0]
mail.HTMLBody = content[1]
mail.CC = cc
mail.Send()
My question is, is there a way to send an email using this method but send it 'from' another mailbox from within my outlook. For example, I have my email "[email protected]" and a mailbox called "[email protected]", which I have send as rights on. Is there a way to change it so that it'll send from the "[email protected]" email? I haven't been able to find any documentation on this query.
Upvotes: 0
Views: 1841
Reputation: 1108
managed to find the solution! If anybody else needs it, use the property:
newMail.SentOnBehalfOfName = 'SharedFolder'
Thanks to programmatically send outlook email from shared mailbox
Upvotes: 1