__init__.py 846 B

12345678910111213141516171819202122232425262728293031323334353637
  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, username: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. username : str
  19. User to send the email with
  20. password : str
  21. Password of the user to send the email with
  22. username : str
  23. Deprecated alias for username. Please use username instead.
  24. **kwargs : dict
  25. See redmail.EmailSender.send
  26. """
  27. sender = EmailSender(
  28. host=host,
  29. port=port,
  30. username=username,
  31. password=password
  32. )
  33. return sender.send(*args, **kwargs)