getting_started.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. Alternatively, there is a pre-configured sender for Gmail.
  26. Please see :ref:`how to configure Gmail <config-gmail>` for more.
  27. Sending Emails
  28. --------------
  29. You can just send emails by calling the method ``send``:
  30. .. code-block:: python
  31. email.send(
  32. subject='email subject',
  33. sender="me@example.com",
  34. receivers=['you@example.com'],
  35. text="Hi, this is an email."
  36. )
  37. Next tutorial covers sending emails more thoroughly.