summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/mail/service.py3
-rw-r--r--src/leap/mail/smtp/__init__.py6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/leap/mail/service.py b/src/leap/mail/service.py
index d595067..f6e4d11 100644
--- a/src/leap/mail/service.py
+++ b/src/leap/mail/service.py
@@ -81,8 +81,9 @@ class OutgoingMail:
:type port: int
"""
- # XXX: should we keep these checks?
# assert params
+ leap_assert_type(from_address, str)
+ leap_assert('@' in from_address)
leap_assert_type(keymanager, KeyManager)
leap_assert_type(host, str)
leap_assert(host != '')
diff --git a/src/leap/mail/smtp/__init__.py b/src/leap/mail/smtp/__init__.py
index f740f5e..72b26ed 100644
--- a/src/leap/mail/smtp/__init__.py
+++ b/src/leap/mail/smtp/__init__.py
@@ -22,7 +22,6 @@ import logging
from twisted.internet import reactor
from twisted.internet.error import CannotListenError
-from twisted.mail import smtp
from leap.mail.service import OutgoingMail
logger = logging.getLogger(__name__)
@@ -42,7 +41,7 @@ def setup_smtp_gateway(port, userid, keymanager, smtp_host, smtp_port,
:param port: The port in which to run the server.
:type port: int
:param userid: The user currently logged in
- :type userid: unicode
+ :type userid: str
:param keymanager: A Key Manager from where to get recipients' public
keys.
:type keymanager: leap.common.keymanager.KeyManager
@@ -61,7 +60,8 @@ def setup_smtp_gateway(port, userid, keymanager, smtp_host, smtp_port,
:returns: tuple of SMTPFactory, twisted.internet.tcp.Port
"""
# configure the use of this service with twistd
- outgoing_mail = OutgoingMail(str(userid), keymanager, smtp_cert, smtp_key, smtp_host, smtp_port)
+ outgoing_mail = OutgoingMail(
+ userid, keymanager, smtp_cert, smtp_key, smtp_host, smtp_port)
factory = SMTPFactory(userid, keymanager, encrypted_only, outgoing_mail)
try:
tport = reactor.listenTCP(port, factory, interface="localhost")