Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
Conflicts:
	email_extras/__init__.py
  • Loading branch information
adrian committed Aug 24, 2016
2 parents 0c816fb + d929b38 commit a472dfd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion AUTHORS
Expand Up @@ -6,4 +6,5 @@
* Eric Amador
* Thomas Stols
* Mario Rosa
* Adrian Bohdanowicz
* Adrian Bohdanowicz
* Tim Heithecker
2 changes: 1 addition & 1 deletion email_extras/__init__.py
@@ -1,2 +1,2 @@

__version__ = "0.3.4"
__version__ = "0.3.3"
6 changes: 3 additions & 3 deletions email_extras/backends.py
Expand Up @@ -23,7 +23,7 @@ def send_messages(self, email_messages):
self.open(body)

def open(self, body):
temp = NamedTemporaryFile(delete=False)
temp.write(body)
temp.close()
with NamedTemporaryFile(delete=False) as temp:
temp.write(body.encode('utf-8'))

webbrowser.open("file://" + temp.name)
2 changes: 1 addition & 1 deletion email_extras/settings.py
Expand Up @@ -6,7 +6,7 @@
GNUPG_HOME = getattr(settings, "EMAIL_EXTRAS_GNUPG_HOME", None)
USE_GNUPG = getattr(settings, "EMAIL_EXTRAS_USE_GNUPG", GNUPG_HOME is not None)
ALWAYS_TRUST = getattr(settings, "EMAIL_EXTRAS_ALWAYS_TRUST_KEYS", False)

GNUPG_ENCODING = getattr(settings, "EMAIL_EXTRAS_GNUPG_ENCODING", None)

if USE_GNUPG:
try:
Expand Down
5 changes: 4 additions & 1 deletion email_extras/utils.py
Expand Up @@ -6,7 +6,8 @@
from django.utils import six
from django.utils.encoding import smart_text

from email_extras.settings import USE_GNUPG, GNUPG_HOME, ALWAYS_TRUST
from email_extras.settings import (USE_GNUPG, GNUPG_HOME, ALWAYS_TRUST,
GNUPG_ENCODING)


if USE_GNUPG:
Expand Down Expand Up @@ -47,6 +48,8 @@ def send_mail(subject, body_text, addr_from, addr_to, fail_silently=False,
# Create the gpg object.
if key_addresses:
gpg = GPG(gnupghome=GNUPG_HOME)
if GNUPG_ENCODING is not None:
gpg.encoding = GNUPG_ENCODING

# Check if recipient has a gpg key installed
def has_pgp_key(addr):
Expand Down

0 comments on commit a472dfd

Please sign in to comment.