aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools/mail.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2014-09-22 13:58:13 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2014-09-22 13:58:13 -0500
commita6252cbf211691aa9d81fd535f5af7bcdbbd6620 (patch)
treeca1131ba7a8ff0437d392c20a70f17ee7470e3dd /mediagoblin/tools/mail.py
parentc47f402d7ee42e88ee1086351010dd598da6c0a5 (diff)
parent6430ae97eca57f4db4bcef54436df6c2abcd21ad (diff)
downloadmediagoblin-a6252cbf211691aa9d81fd535f5af7bcdbbd6620.tar.lz
mediagoblin-a6252cbf211691aa9d81fd535f5af7bcdbbd6620.tar.xz
mediagoblin-a6252cbf211691aa9d81fd535f5af7bcdbbd6620.zip
Merge branch 'merge-python3-port'
Conflicts: setup.py
Diffstat (limited to 'mediagoblin/tools/mail.py')
-rw-r--r--mediagoblin/tools/mail.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/mediagoblin/tools/mail.py b/mediagoblin/tools/mail.py
index ab355835..ab3e0eaa 100644
--- a/mediagoblin/tools/mail.py
+++ b/mediagoblin/tools/mail.py
@@ -14,11 +14,13 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import print_function, unicode_literals
+
import six
import smtplib
import sys
-from email.MIMEText import MIMEText
from mediagoblin import mg_globals, messages
+from mediagoblin._compat import MIMEText
from mediagoblin.tools import common
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -130,12 +132,12 @@ def send_email(from_addr, to_addrs, subject, message_body):
EMAIL_TEST_INBOX.append(message)
elif mg_globals.app_config['email_debug_mode']:
- print u"===== Email ====="
- print u"From address: %s" % message['From']
- print u"To addresses: %s" % message['To']
- print u"Subject: %s" % message['Subject']
- print u"-- Body: --"
- print message.get_payload(decode=True)
+ print("===== Email =====")
+ print("From address: %s" % message['From'])
+ print("To addresses: %s" % message['To'])
+ print("Subject: %s" % message['Subject'])
+ print("-- Body: --")
+ print(message.get_payload(decode=True))
return mhost.sendmail(from_addr, to_addrs, message.as_string())
@@ -162,5 +164,5 @@ def email_debug_message(request):
if mg_globals.app_config['email_debug_mode']:
# DEBUG message, no need to translate
messages.add_message(request, messages.DEBUG,
- u"This instance is running in email debug mode. "
- u"The email will be on the console of the server process.")
+ "This instance is running in email debug mode. "
+ "The email will be on the console of the server process.")