littlefish/background/emailqueue.py
def queue_email(to_addresses, from_address, subject, body, commit=True, html=True, session=None):
    """
    Add a mail to the queue to be sent.

    WARNING: Commits by default!

    :param to_addresses: The names and addresses to send the email to, i.e. "Steve<steve@fig14.com>, info@fig14.com"
    :param from_address: Who the email is from i.e. "Stephen Brown <s@fig14.com>"
    :param subject: The email subject
    :param body: The html / text body of the email
    :param commit: Whether to commit to the database
    :param html: Is this a html email?
    :param session: The sqlalchemy session or None to use db.session
    """
    from models import QueuedEmail

    if session is None:
        session = _db.session

    log.info('Queuing mail to %s: %s' % (to_addresses, subject))
    queued_email = QueuedEmail(html, to_addresses, from_address, subject, body, STATUS_QUEUED)
    session.add(queued_email)
    session.commit()

    return queued_email
def queue_email(to_addresses, from_address, subject, body, commit=True, html=True, session=None):
    """
    Add a mail to the queue to be sent.

    WARNING: Commits by default!

    :param to_addresses: The names and addresses to send the email to, i.e. "Steve<steve@fig14.com>, info@fig14.com"
    :param from_address: Who the email is from i.e. "Stephen Brown <s@fig14.com>"
    :param subject: The email subject
    :param body: The html / text body of the email
    :param commit: Whether to commit to the database
    :param html: Is this a html email?
    :param session: The sqlalchemy session or None to use db.session
    """
    from models import QueuedEmail

    if session is None:
        session = _db.session

    log.info('Queuing mail to %s: %s' % (to_addresses, subject))
    queued_email = QueuedEmail(html, to_addresses, from_address, subject, body, STATUS_QUEUED)
    session.add(queued_email)
    session.commit()

    return queued_email
Add a mail to the queue to be sent.

    WARNING: Commits by default!

    :param to_addresses: The names and addresses to send the email to, i.e. "Steve<steve@fig14.com>, info@fig14.com"
    :param from_address: Who the email is from i.e. "Stephen Brown <s@fig14.com>"
    :param subject: The email subject
    :param body: The html / text body of the email
    :param commit: Whether to commit to the database
    :param html: Is this a html email?
    :param session: The sqlalchemy session or None to use db.session