python library for useful tools
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

pylib - email sender, html parser, tf-idf, image extracter & file archiver

python library for useful tools

Email sender using HTML/TEXT templates

Step 1:

Create a TEXT/HTML file with the Keys as below

Hi [username],

Thank you for your registration.

Best regards,

Step 2:

Create a template passing the values to replace with the keys in template

values = {}
values['username'] = 'Ludmal de silva!'
values['from'] = 'The Team'
values['url'] = ''
temp = EmailTemplate(template_name='welcome.txt', values=values)

Step 3:

Create a Mail Server

server = MailServer(server_name='', username='<username>', password='<password>', port=0,   require_starttls=True)

Step 4:

Create a mail message and send the email

msg = MailMessage(from_email='', to_emails=[''], subject='Welcome')
send(mail_msg=msg, mail_server=server, template=temp)

Follow me on Twitter @ludmal