Exemplo n.º 1
0
def init_mailer():
    if CHARSETS:
        for canonical, charset_dict in CHARSETS.iteritems():
            add_charset(canonical, **charset_dict)

    if ALIASES:
        for alias, canonical in ALIASES.iteritems():
            add_alias(alias, canonical)

    if CODECS:
        for canonical, codec_name in CODECS.iteritems():
            add_codec(canonical, codec_name)
Exemplo n.º 2
0
def init_mailer():
    if CHARSETS:
        for canonical, charset_dict in six.iteritems(CHARSETS):
            add_charset(canonical, **charset_dict)

    if ALIASES:
        for alias, canonical in six.iteritems(ALIASES):
            add_alias(alias, canonical)

    if CODECS:
        for canonical, codec_name in six.iteritems(CODECS):
            add_codec(canonical, codec_name)
Exemplo n.º 3
0
from email.mime.text import MIMEText
from email.utils import formataddr, parseaddr

import os
import time

import Defaults
import Util
import Version


DEFAULT_CHARSET = 'US-ASCII'

# Extend Charset.ALIASES with some charsets which don't already have
# convenient aliases.
add_alias('cyrillic', 'iso-8859-5')
add_alias('greek', 'iso-8859-7')
add_alias('hebrew', 'iso-8859-8')
add_alias('japanese', 'euc-jp')
add_alias('korean', 'euc-kr')
add_alias('russian', 'koi8-r')
add_alias('thai', 'tis-620')
add_alias('turkish', 'iso-8859-9')
add_alias('vietnamese', 'viscii')


class AutoResponse:
    def __init__(self, msgin, bouncetext, response_type, recipient):
        """
        msgin is an email.message object representing the incoming
        message we are responding to.
Exemplo n.º 4
0
    removeSecurityProxy,
)
from zope.sendmail.interfaces import IMailDelivery

from lp.app import versioninfo
from lp.services.config import config
from lp.services.encoding import is_ascii_only
from lp.services.mail.stub import TestMailer
from lp.services.timeline.requesttimeline import get_request_timeline

# email package by default ends up encoding UTF-8 messages using base64,
# which sucks as they look like spam to stupid spam filters. We define
# our own custom charset definition to force quoted printable.
del charset.CHARSETS['utf-8']
charset.add_charset('utf-8', charset.SHORTEST, charset.QP, 'utf-8')
charset.add_alias('utf8', 'utf-8')


def do_paranoid_email_content_validation(from_addr, to_addrs, subject, body):
    """Validate various bits of the email.

    Extremely paranoid parameter checking is required to ensure we
    raise an exception rather than stick garbage in the mail
    queue. Currently, the Z3 mailer is too forgiving and accepts badly
    formatted emails which the delivery mechanism then can't send.

    An AssertionError will be raised if one of the parameters is
    invalid.
    """
    # XXX StuartBishop 2005-03-19:
    # These checks need to be migrated upstream if this bug