Пример #1
0
def adding_others_reply(fulist, last_email, thread_id):

    msg = MIMEText(new_body)
    msg = MIMEText("Adding Others" + "\r\n\r\n> " + mail.quote(last_email))
    msg['cc'] = ( ",".join([SARA_F] + [addr for addr in fulist if addr != last_email['from']]))
    msg['subject'] = last_email['subject']
    msg['from'] = SARA_F
    msg.add_header("In-Reply-To", last_email["Message-ID"])
    msg.add_header("References", last_email['References'] + " " +last_email["Message-ID"])
    message = {'threadId': thread_id, 'raw': base64.urlsafe_b64encode(msg.as_string())}
    result = google.SendMessage(gm, 'me', message, thread_id)
    if result is not None:
        return 'success'
Пример #2
0
def adding_others_reply(fulist, last_email, thread_id):

    msg = MIMEText(new_body)
    msg = MIMEText("Adding Others" + "\r\n\r\n> " + mail.quote(last_email))
    msg['cc'] = (
        ",".join([SARA_F] +
                 [addr for addr in fulist if addr != last_email['from']]))
    msg['subject'] = last_email['subject']
    msg['from'] = SARA_F
    msg.add_header("In-Reply-To", last_email["Message-ID"])
    msg.add_header("References",
                   last_email['References'] + " " + last_email["Message-ID"])
    message = {
        'threadId': thread_id,
        'raw': base64.urlsafe_b64encode(msg.as_string())
    }
    result = google.SendMessage(gm, 'me', message, thread_id)
    if result is not None:
        return 'success'
Пример #3
0
def reply(to_addrs, cc_addrs, new_body, last_email, delete, thread_id):

    if delete:
        msg = MIMEText(new_body)
    else:
        msg = MIMEText(new_body + "\r\n\r\n> " + mail.quote(last_email))

    msg['to'] = to_addrs
    if cc_addrs is not None:
        msg['cc'] = cc_addrs

    msg['bcc'] = SARA_F
    sara_debug("SARA CCCCCC" + SARA_F + ("," + cc_addrs if cc_addrs else ""))

    sub = last_email['subject']
    if len(sub) < 3:
        new_sub = 'Re:' + sub
    else:
        if (sub.lower()[0:3] == 're:'):
            new_sub = sub
        else:
            new_sub = 'Re:' + sub
    msg['subject'] = new_sub
    msg['from'] = SARA_F

    msg.add_header("In-Reply-To", last_email["Message-ID"])

    if last_email['References'] is not None:
        msg.add_header(
            "References",
            last_email['References'] + " " + last_email["Message-ID"])
    else:
        msg.add_header("References", last_email["Message-ID"])

    message = {
        'threadId': thread_id,
        'raw': base64.urlsafe_b64encode(msg.as_string())
    }
    result = google.SendMessage(gm, 'me', message, thread_id)

    if result is not None:
        return 'success'
Пример #4
0
def reply(to_addrs, cc_addrs, new_body, last_email, delete, thread_id):

    if delete:
        msg = MIMEText(new_body)
    else:
        msg = MIMEText(new_body + "\r\n\r\n> " + mail.quote(last_email))

    msg['to'] = to_addrs
    if cc_addrs is not None:
        msg['cc'] = cc_addrs

    msg['bcc'] = SARA_F
    sara_debug("SARA CCCCCC"+SARA_F + ("," + cc_addrs if cc_addrs else ""))

    sub = last_email['subject']
    if len(sub) < 3:
        new_sub = 'Re:'+sub
    else:
        if (sub.lower()[0:3] == 're:'):
           new_sub = sub
        else:
            new_sub = 'Re:'+sub
    msg['subject'] = new_sub
    msg['from'] = SARA_F

    msg.add_header("In-Reply-To", last_email["Message-ID"])

    if last_email['References'] is not None:
        msg.add_header("References", last_email['References'] + " " +last_email["Message-ID"])
    else:
        msg.add_header("References", last_email["Message-ID"])


    message = {'threadId': thread_id, 'raw': base64.urlsafe_b64encode(msg.as_string())}
    result = google.SendMessage(gm, 'me', message, thread_id)

    if result is not None:
        return 'success'