New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utils.mail or Mail Interface #182

Closed
derks opened this Issue Nov 20, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@derks
Member

derks commented Nov 20, 2012

Sending email is a pretty common need for command line apps. Having an IMail interface would be handy, and would allow app developers to easily add [mail] configurations to their app config files. Think:

  • DummyMailHandler (prints email to console, doesn't actually send)
  • SMTPHandler (sends using smtplib with smtp server configurations)
  • SendmailHandler (sends using smtplib.sendmail)
  • MailGun (sends email using MailGun Service)
  • Etc....

Note that this use case would likely need 'mail_handler' added to the list of 'allow_meta_override' so that under your primary application's config you can set 'mail_handler = dummy' or whatever and not make it a hardcoded application setting.

@ghost ghost assigned derks Nov 20, 2012

@derks

This comment has been minimized.

Show comment
Hide comment
@derks

derks Jan 23, 2014

Member
[myapp]
mail_handler = sendgrid

[mail.sendgrid]
api_type = "web" # SendGrid support Web or SMTP
username = "some_user_name"
password = "some_password"
default_to = "notifications@example.com"
default_from = "bot@example.com"
default_subject = "This is a message from Example"
default_cc = me@example.com, you@example.com
default_bcc = other@example.com
app.mail.send("This is the message going to all default recipients.")

app.mail.send(
    body='This is the message.',
    to=['me@example.com', 'you@example.com'], 
    cc=['other@example.com'],
    bcc=['even-more@example.com'],
    subject='Howdy', 
    from='me@example.com',
    )
Member

derks commented Jan 23, 2014

[myapp]
mail_handler = sendgrid

[mail.sendgrid]
api_type = "web" # SendGrid support Web or SMTP
username = "some_user_name"
password = "some_password"
default_to = "notifications@example.com"
default_from = "bot@example.com"
default_subject = "This is a message from Example"
default_cc = me@example.com, you@example.com
default_bcc = other@example.com
app.mail.send("This is the message going to all default recipients.")

app.mail.send(
    body='This is the message.',
    to=['me@example.com', 'you@example.com'], 
    cc=['other@example.com'],
    bcc=['even-more@example.com'],
    subject='Howdy', 
    from='me@example.com',
    )

@derks derks assigned derks and unassigned derks Aug 21, 2014

derks added a commit that referenced this issue Sep 9, 2014

derks added a commit that referenced this issue Sep 12, 2014

@derks derks closed this Sep 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment