Skip to content

Instantly share code, notes, and snippets.

@jorgeluisyh
Created October 18, 2022 15:03
Show Gist options
  • Save jorgeluisyh/435de7119d6483f8165151162aa8b1a2 to your computer and use it in GitHub Desktop.
Save jorgeluisyh/435de7119d6483f8165151162aa8b1a2 to your computer and use it in GitHub Desktop.
Enviar correo Outlook
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