项目作者: solry

项目描述 :
One-line email sender with attachments, cc, bcc and send-as capability
高级语言: Python
项目地址: git://github.com/solry/nmail.git
创建时间: 2018-08-29T16:34:41Z
项目社区:https://github.com/solry/nmail

开源协议:MIT License

下载


nmail

SMTP mail sender.

With this package you will able to send mails in 1 line.
There is two operations mode:

Installation:

  1. pip install nmail

Inline mode:

Send Email inline:

  1. import nmail
  2. nmail.send_mail(to=['mybro@example.com','someone@example.com'],
  3. cc=['copy@example.com'],
  4. bcc=['hidden_copy@example.com'],
  5. subject='No subject',
  6. text='No Text',
  7. attachments=['/tmp/test.txt'],
  8. send_as='delegated_mailbox@example.com',
  9. smtp_server='10.0.0.1'
  10. smtp_port=587
  11. login='username@corp.com'
  12. password='password')

Also, you may override some of parameters by specifying it in the send_mail function call.
Other params will be gathered from config file

Config mode:

Use config.yml to specify next variables:

  1. smtp_server: '10.0.0.1'
  2. smtp_port: 587
  3. login: 'username@corp.com'
  4. password: 'password'

Send email with specifying config.yml file:

  1. import nmail
  2. nmail.send_mail(to=['mybro@example.com','someone@example.com'],
  3. cc=['copy@example.com'],
  4. bcc=['hidden_copy@example.com'],
  5. subject='No subject',
  6. text='No Text',
  7. attachments=['/tmp/test.txt'],
  8. send_as='delegated_mailbox@example.com',
  9. config='/tmp/config.yml')

If you will not specify config variable - by default nmail will pick config.yml from package folder