Did I find the right examples for you? yes no

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
mail_it is used for sending out mail (duh)

arguments:
- who to send it to
- who the message comes from
- the email subject
- the message

        def mail_it(rcptto, mailfrom, subject, message, replyto=None):
    """ mail_it is used for sending out mail (duh)

    arguments:
    - who to send it to
    - who the message comes from
    - the email subject
    - the message
    """

    if replyto == None:
        replyto = mailfrom

    # Build up our email message
    if isinstance(message, Message):
        msg = message
    else:
        msg = Message()
        msg['From'] = mailfrom
        msg['To'] = rcptto if isinstance(rcptto, str) else ', '.join(rcptto)
        msg['Reply-To'] = replyto
        msg['Subject'] = subject
        msg.set_payload(message)

    msg = msg.as_string()

    # Then send it
    try:
        if EMAIL_USE_SSL:
            smtpObj = smtplib.SMTP_SSL(EMAIL_HOST, EMAIL_PORT)
            smtpObj.login(EMAIL_USER, EMAIL_PASSWORD)
        else:
            smtpObj = smtplib.SMTP(EMAIL_HOST, EMAIL_PORT)
        smtpObj.sendmail(mailfrom, rcptto, msg)
        write_log('email sent')
    except Exception, e:
        write_log('unable to send mail: "%s"' % e)
        


src/l/o/lol-logwatcher-HEAD/differ.py   lol-logwatcher(Download)
    if DIFFER_EMAIL_ERRORS:
        subject = 'Differ ERRORS: %s' % myhost
        util.mail_it(RCPT_TO, MAIL_FROM, subject, error_msg, 'dev@example.com')
 
    # send to the syslog on DIFFERLOGHOST the fact that we sent out an error

src/l/o/lol-logwatcher-HEAD/lolfly.py   lol-logwatcher(Download)
            msg += util.write_log('LOLFLY ERROR: submitting info for %s %s %s' % \
                   (code_location, code_method, exception))
            util.mail_it(ERROR_TO, MAIL_FROM, 'DIFFER GOT AN ERROR', msg, REPLY_TO)
 
    # second section, get the errors without exceptions
        emailoutput = '%s\n\nSUMMARY:%s case(s) filed' % (output, case_count)
        if LOLFLY_EMAIL_ERRORS:
            util.mail_it(lolfly_rcpt_to, MAIL_FROM, subject, emailoutput, REPLY_TO)
 
    util.write_log('%s cases were filed' % case_count)

src/l/o/lol-logwatcher-HEAD/summarize_bugs.py   lol-logwatcher(Download)
        emailto = lolfly.RCPT_TO
 
        util.mail_it(emailto, lolfly.MAIL_FROM, subject, msg, lolfly.REPLY_TO)
    else:
        print filederrors