SmtpSv

class clink.service.SmtpSv(app_conf, auth_conf)[source]

Send mail message on SMTP

Parameters:
send(dest_email, subject, text_body)[source]

Send plain text message

Parameters:
  • dest_email (str) –
  • subject (str) –
  • text_body (str) –

Example

smtp_sv.py
from clink.service import SmtpSv, AuthConf
from clink import AppConf


app_conf = AppConf('Awesome Application')

sender_email = 'you@email.com'
sender_email_password = 'secret-words'
email_server_address = 'smtp.email.com'
email_server_port = 587
auth_conf = AuthConf(
    'root-pwd', sender_email, sender_email_password,
    email_server_address, email_server_port, 'jwt-key'
)

smtp = SmtpSv(app_conf, auth_conf)

receiver = 'someone@email.com'
subject = 'Let be friends'
content = 'Hello there'
smtp.send(receiver, subject, content)

Testing

# replace your email, password and server then run
$ python smtp_sv.py