Created
October 18, 2022 15:03
-
-
Save jorgeluisyh/435de7119d6483f8165151162aa8b1a2 to your computer and use it in GitHub Desktop.
Enviar correo Outlook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_mail(destinos, asunto, cuerpo, cuerpohtml='', adjunto=''): | |
import win32com.client as win32 | |
outlook = win32.Dispatch('outlook.application') | |
mail = outlook.CreateItem(0) | |
mail.To = destinos | |
mail.Subject = asunto | |
mail.Body = cuerpo | |
mail.HTMLBody = cuerpohtml #this field is optional | |
if adjunto: | |
attachment = adjunto | |
mail.Attachments.Add(attachment) | |
mail.Send() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment