Ejemplo n.º 1
0
def send():
    """
    Sends an test e-mail using mailtools package 'mailSender' module
    :return: None
    """
    if not mailconfig.smtpuser:
        sender = MailSender(tracesize=5000)
    else:
        sender = MailSenderAuthConsole(tracesize=5000)

    # send the e-mail
    sender.sendMessage(From=mailconfig.myaddress,
                       To=[mailconfig.myaddress],
                       Subj='testing mailtools package',
                       extrahdrs=[('X-Mailer', 'mailtools')],
                       bodytext='Here is my source code\n',
                       attaches=['selftest.py'],
                       )
Ejemplo n.º 2
0
#!/usr/bin/python3
import sys
import mailconfig
sys.path.append('..')
print('config:', mailconfig.__file__)

# from mailFetcher import MailFetcherConsole
# from mailParser import MailParser
# from mailSender import MailSender, MailSenderAuthConsole
from mailtools import (MailFetcherConsole, MailSender, MailSenderAuthConsole,
                       MailParser)

if not mailconfig.smtpusername:
    sender = MailSender()
else:
    sender = MailSenderAuthConsole()

sender.sendMessage(From=mailconfig.myaddress,
                   To=[mailconfig.recevieaddr],
                   Subj='testing mailtools package',
                   extrahdrs=[('X-Mailer', 'mailtools')],
                   bodytext='Here is my source code\n',
                   attaches=['selftest.py'])

fetcher = MailFetcherConsole()


def status(*args):
    print(args)

Ejemplo n.º 3
0
# mailconfig normally comes from the client's source directory or
# sys.path; for testing, get it from Email directory one level up
#
import sys
sys.path.append('..')
import mailconfig
print('config:', mailconfig.__file__)

# get these from __init__
from mailtools import (MailFetcherConsole, MailSender, MailSenderAuthConsole,
                       MailParser)

if not mailconfig.smtpuser:
    sender = MailSender(tracesize=5000)
else:
    sender = MailSenderAuthConsole(tracesize=5000)

sender.sendMessage(
    From=mailconfig.myaddress,
    To=[mailconfig.myaddress],
    Subj='testing mailtools package',
    extrahdrs=[('X-Mailer', 'mailtools')],
    bodytext='Here is my source code\n',
    attaches=['selftest.py'],
)

# bodytextEncoding='utf-8',          # other tests to try
# attachesEncodings=['latin-1'],     # inspect text headers
# attaches=['monkeys.jpg'])          # verify Base64 encoded

# change mailconfig to test fetchlimit