Example #1
0
def create_email(sender_name, sender_email, inbox_uid, recipients,
                 subject, body, attachments=None):
    """ Create a Generic email. """
    mimemsg = create_base_email(sender_name, sender_email, inbox_uid,
                                recipients, subject, body, attachments)

    return smtp_attrs(mimemsg)
Example #2
0
def create_reply(sender_name, sender_email, in_reply_to, references,
                 inbox_uid, recipients, subject, body, attachments=None):
    """ Create a Generic email reply. """
    mimemsg = create_base_email(sender_name, sender_email, inbox_uid,
                                recipients, subject, body, attachments)

    # Add general reply headers:
    if in_reply_to:
        mimemsg.headers['In-Reply-To'] = in_reply_to
    if references:
        mimemsg.headers['References'] = references

    # Set the 'Subject' header of the reply
    # Some providers require the same subject as the original (adding Re:/Fwd:
    # is fine though) to group messages in the same conversation, See:
    # https://support.google.com/mail/answer/5900?hl=en
    mimemsg.headers['Subject'] = REPLYSTR + subject

    return smtp_attrs(mimemsg)