Edvard Rejthar

Hi, thanks for your code. Since 2019, all the e-mail related burden might be releaved with the envelope library at https://github.com/CZ-NIC/envelope. No hassle with the magic or attachments or required headers or smtp. Single object call will do all this for you so that you can concentrate on your business logic, not the e-mail implementation details.

Install it with: pip install envelope

Import it and write a single line:

from envelope import Envelope
Envelope().message('Message body\n').subject('Subject').from_('sender@example.com').to(['recipient@example.net', 'cc@example.net', 'bcc@example.net']).attach(path='/path/to/attachment1').attach(path='/path/to/attachment2').smtp('localhost').send(0)

 

Tue, 15/11/2022 - 15:57 Permalink

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <p> <br> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA