__init__.py 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. from .sender import EmailSender
  2. gmail = EmailSender(
  3. host="smtp.gmail.com",
  4. port=587,
  5. )
  6. outlook = EmailSender(
  7. host='smtp.office365.com',
  8. port=587,
  9. )
  10. def send_email(*args, host:str, port:int, user_name:str=None, password:str=None, **kwargs):
  11. """Send email
  12. Parameters
  13. ----------
  14. host : str
  15. Address of the SMTP host
  16. port : int
  17. Port of the SMTP server
  18. user_name : str
  19. User to send the email with
  20. password : str
  21. Password of the user to send the email with
  22. **kwargs : dict
  23. See redmail.EmailSender.send
  24. """
  25. sender = EmailSender(
  26. host=host,
  27. port=port,
  28. user_name=user_name,
  29. password=password
  30. )
  31. return sender.send(*args, **kwargs)