getting_started.rst 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. .. _getting-started:
  2. Getting started
  3. ===============
  4. Install the package from `Pypi <https://pypi.org/project/redmail/>`_:
  5. .. code-block:: console
  6. pip install redmail
  7. .. _configure:
  8. Configuring Email
  9. -----------------
  10. You can configure your sender by:
  11. .. code-block:: python
  12. from redmail import EmailSender
  13. email = EmailSender(
  14. host='<SMTP HOST>',
  15. port='<SMTP PORT>',
  16. user_name='<USER_NAME>',
  17. password='<PASSWORD>'
  18. )
  19. .. code-block:: python
  20. # Or if your SMTP server does not require credentials
  21. email = EmailSender(
  22. host='<SMTP HOST>',
  23. port='<SMTP PORT>',
  24. )
  25. There are guides to set up the following email providers:
  26. - :ref:`config-gmail`
  27. - :ref:`config-outlook`
  28. Sending Emails
  29. --------------
  30. You can just send emails by calling the method ``send``:
  31. .. code-block:: python
  32. email.send(
  33. subject='email subject',
  34. sender="me@example.com",
  35. receivers=['you@example.com'],
  36. text="Hi, this is an email."
  37. )
  38. Next tutorial covers sending emails more thoroughly.