getting_started.rst 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 redengine
  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. If your SMTP server does not require login to send emails then
  20. just don't pass ``user_name`` and ``password`` to ``EmailSender``.
  21. Alternatively, if you use Gmail there is a pre-configured sender
  22. which you can just import and set user name and password:
  23. .. code-block:: python
  24. from redmail import gmail
  25. gmail.user_name = 'me@gmail.com'
  26. gmail.password = '<PASSWORD>'
  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. receivers=['first.last@example.com'],
  34. text="Hi, this is an email."
  35. )
  36. Next tutorial covers sending emails more thoroughly.