Mail¶
SendEmail¶
-
class
boilerplate.mail.SendEmail(to, subject, is_html=False, template_name_suffix=None, content=None)[source]¶ Send an emails or several emails easily.
Example
email = SendEmail( to='user@example.com', template_name_suffix='recover-account', subject='Recover your account', is_html=True ) email.set_from_email('no-reply@example.com') email.set_from_name('No Reply') email.add_context_data('protocol', 'https') email.add_context_data('domain', 'example.com') email.add_context_data('uid', uid) email.add_context_data('token', token) email.add_context_data('object', user) email.add_context_data('site_name', 'Boilerplate - Make it easy') email.send()
-
add_context_data(key, value)[source]¶ Add a key-value to the context data of the email
- Parameters:
key: A valid key name value: Can be an object or any kind of value
-
set_from_email(from_email=None)[source]¶ Set the email sender
- Parameters:
from_email: String, a valid email
-
set_from_name(from_name=None)[source]¶ Set the name sender
- Parameters:
from_name: String, a valid name
-