This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
python-emails/emails/testsuite/message/helpers.py

32 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding: utf-8
from __future__ import unicode_literals
import os
import emails
from emails.template import JinjaTemplate
TO_EMAIL = 'jbrown@hotmail.tld'
FROM_EMAIL = 'robot@company.tld'
TRAVIS_CI = os.environ.get('TRAVIS')
ROOT = os.path.dirname(__file__)
def common_email_data(**kw):
T = JinjaTemplate
data = {'charset': 'utf-8',
'subject': T('Olá {{name}}'),
'mail_from': ('LÖVÅS HÅVET', FROM_EMAIL),
'mail_to': ('Pestävä erillään', TO_EMAIL),
'html': T('<h1>Olá {{name}}!</h1><p>O Lorem Ipsum é um texto modelo da indústria tipográfica e de impressão.'),
'text': T('Olá, {{name}}!\nO Lorem Ipsum é um texto modelo da indústria tipográfica e de impressão.'),
'headers': {'X-Mailer': 'python-emails'},
'message_id': emails.MessageID(),
'attachments': [
{'data': 'Sample text', 'filename': 'κατάσχεση.txt'},
{'data': open(os.path.join(ROOT, 'data/pushkin.jpg'), 'rb'), 'filename': 'Пушкин А.С.jpg'}
]}
if kw:
data.update(kw)
return data