~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/mail/sendmail.py

  • Committer: mbp at canonical
  • Date: 2011-09-15 06:39:13 UTC
  • mto: This revision was merged to the branch mainline in revision 13963.
  • Revision ID: mbp@canonical.com-20110915063913-xea8ii1ih18x21ws
process-one-mail arranges for sent mail to be printed to stdout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""The One True Way to send mail from the Launchpad application.
42
42
    )
43
43
import hashlib
44
44
from smtplib import SMTP
 
45
import sys
45
46
 
46
47
from lazr.restful.utils import get_current_browser_request
47
48
from zope.app import zapi
427
428
            # when running in the testing environment, store emails
428
429
            TestMailer().send(
429
430
                config.canonical.bounce_address, to_addrs, raw_message)
 
431
        elif getattr(config, 'sendmail_to_stdout', None):
 
432
            # For debugging, from process-one-mail, just print it.
 
433
            sys.stdout.write(raw_message)
430
434
        else:
431
435
            if config.zopeless.send_email:
432
436
                # Note that we simply throw away dud recipients. This is fine,