getting_started.rst 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. .. note::
  29. By default, Red Mail uses **STARTTLS** as the protocol.
  30. This is suitable for majority of cases but if you need
  31. to use **SSL**, **TLS** or other protocols, see :ref:`config-smtp`.
  32. Sending Emails
  33. --------------
  34. You can just send emails by calling the method ``send``:
  35. .. code-block:: python
  36. email.send(
  37. subject='email subject',
  38. sender="me@example.com",
  39. receivers=['you@example.com'],
  40. text="Hi, this is an email."
  41. )
  42. Next tutorial covers sending emails more thoroughly.