Merge remote-tracking branch 'origin/master' into ac-dmarc-reply-phase
This commit is contained in:
commit
8df6d98522
|
@ -6,6 +6,9 @@ import random
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
|
from aiosmtpd.smtp import Envelope
|
||||||
|
|
||||||
from email import policy, message_from_bytes, message_from_string
|
from email import policy, message_from_bytes, message_from_string
|
||||||
from email.header import decode_header, Header
|
from email.header import decode_header, Header
|
||||||
from email.message import Message, EmailMessage
|
from email.message import Message, EmailMessage
|
||||||
|
@ -1429,7 +1432,7 @@ def save_email_for_debugging(msg: Message, file_name_prefix=None) -> str:
|
||||||
if TEMP_DIR:
|
if TEMP_DIR:
|
||||||
file_name = str(uuid.uuid4()) + ".eml"
|
file_name = str(uuid.uuid4()) + ".eml"
|
||||||
if file_name_prefix:
|
if file_name_prefix:
|
||||||
file_name = file_name_prefix + file_name
|
file_name = "{}-{}".format(file_name_prefix, file_name)
|
||||||
|
|
||||||
with open(os.path.join(TEMP_DIR, file_name), "wb") as f:
|
with open(os.path.join(TEMP_DIR, file_name), "wb") as f:
|
||||||
f.write(msg.as_bytes())
|
f.write(msg.as_bytes())
|
||||||
|
@ -1438,3 +1441,22 @@ def save_email_for_debugging(msg: Message, file_name_prefix=None) -> str:
|
||||||
return file_name
|
return file_name
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def save_envelope_for_debugging(envelope: Envelope, file_name_prefix=None) -> str:
|
||||||
|
"""Save envelope for debugging to temporary location
|
||||||
|
Return the file path
|
||||||
|
"""
|
||||||
|
if TEMP_DIR:
|
||||||
|
file_name = str(uuid.uuid4()) + ".eml"
|
||||||
|
if file_name_prefix:
|
||||||
|
file_name = "{}-{}".format(file_name_prefix, file_name)
|
||||||
|
|
||||||
|
with open(os.path.join(TEMP_DIR, file_name), "wb") as f:
|
||||||
|
f.write(envelope.original_content)
|
||||||
|
|
||||||
|
LOG.d("envelope saved to %s", file_name)
|
||||||
|
return file_name
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,7 @@ from app.email_utils import (
|
||||||
get_orig_message_from_yahoo_complaint,
|
get_orig_message_from_yahoo_complaint,
|
||||||
get_mailbox_bounce_info,
|
get_mailbox_bounce_info,
|
||||||
save_email_for_debugging,
|
save_email_for_debugging,
|
||||||
|
save_envelope_for_debugging,
|
||||||
)
|
)
|
||||||
from app.errors import (
|
from app.errors import (
|
||||||
NonReverseAliasInReplyPhase,
|
NonReverseAliasInReplyPhase,
|
||||||
|
@ -2131,6 +2132,11 @@ def handle(envelope: Envelope, msg: Message) -> str:
|
||||||
envelope.mail_from = mail_from
|
envelope.mail_from = mail_from
|
||||||
envelope.rcpt_tos = rcpt_tos
|
envelope.rcpt_tos = rcpt_tos
|
||||||
|
|
||||||
|
# some emails don't have this header, set the default value (7bit) in this case
|
||||||
|
if headers.CONTENT_TRANSFER_ENCODING not in msg:
|
||||||
|
LOG.i("Set CONTENT_TRANSFER_ENCODING")
|
||||||
|
msg[headers.CONTENT_TRANSFER_ENCODING] = "7bit"
|
||||||
|
|
||||||
postfix_queue_id = get_queue_id(msg)
|
postfix_queue_id = get_queue_id(msg)
|
||||||
if postfix_queue_id:
|
if postfix_queue_id:
|
||||||
set_message_id(postfix_queue_id)
|
set_message_id(postfix_queue_id)
|
||||||
|
@ -2467,7 +2473,7 @@ class MailHandler:
|
||||||
msg[headers.TO],
|
msg[headers.TO],
|
||||||
)
|
)
|
||||||
return status.E524
|
return status.E524
|
||||||
except (VERPReply, VERPForward) as e:
|
except (VERPReply, VERPForward, VERPTransactional) as e:
|
||||||
LOG.w(
|
LOG.w(
|
||||||
"email handling fail with error:%s "
|
"email handling fail with error:%s "
|
||||||
"mail_from:%s, rcpt_tos:%s, header_from:%s, header_to:%s",
|
"mail_from:%s, rcpt_tos:%s, header_from:%s, header_to:%s",
|
||||||
|
@ -2487,8 +2493,8 @@ class MailHandler:
|
||||||
envelope.rcpt_tos,
|
envelope.rcpt_tos,
|
||||||
msg[headers.FROM],
|
msg[headers.FROM],
|
||||||
msg[headers.TO],
|
msg[headers.TO],
|
||||||
save_email_for_debugging(
|
save_envelope_for_debugging(
|
||||||
msg, file_name_prefix=e.__class__.__name__
|
envelope, file_name_prefix=e.__class__.__name__
|
||||||
), # todo: remove
|
), # todo: remove
|
||||||
)
|
)
|
||||||
return status.E404
|
return status.E404
|
||||||
|
|
|
@ -11,5 +11,5 @@ Please note that sending non-solicited from a SimpleLogin alias infringes our te
|
||||||
|
|
||||||
If somehow the recipient's Hotmail considers a forwarded email as Spam, it helps us a lot if you can ask them to move the email out of their Spam folder.
|
If somehow the recipient's Hotmail considers a forwarded email as Spam, it helps us a lot if you can ask them to move the email out of their Spam folder.
|
||||||
|
|
||||||
Looking to hear back from you.
|
Don't hesitate to get in touch with us if you need more information.
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call text() %}
|
{% call text() %}
|
||||||
Looking to hear back from you.
|
Don't hesitate to get in touch with us if you need more information.
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call text() %}
|
{% call text() %}
|
||||||
|
|
|
@ -16,5 +16,5 @@ If that’s the case, please disable the alias instead if you don't want to rece
|
||||||
If somehow Hotmail considers a forwarded email as Spam, it will help us if you can move the email out of the Spam folder.
|
If somehow Hotmail considers a forwarded email as Spam, it will help us if you can move the email out of the Spam folder.
|
||||||
You can also set up a filter to avoid this from happening in the future using this guide at https://simplelogin.io/help/
|
You can also set up a filter to avoid this from happening in the future using this guide at https://simplelogin.io/help/
|
||||||
|
|
||||||
Looking to hear back from you.
|
Don't hesitate to get in touch with us if you need more information.
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call text() %}
|
{% call text() %}
|
||||||
Looking to hear back from you.
|
Don't hesitate to get in touch with us if you need more information.
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call text() %}
|
{% call text() %}
|
||||||
|
|
|
@ -19,5 +19,5 @@ If somehow Hotmail considers a forwarded email as Spam, it helps us if you can m
|
||||||
|
|
||||||
Please don't put our emails into the Spam folder. This can end up in your account being disabled on SimpleLogin.
|
Please don't put our emails into the Spam folder. This can end up in your account being disabled on SimpleLogin.
|
||||||
|
|
||||||
Looking to hear back from you.
|
Don't hesitate to get in touch with us if you need more information.
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call text() %}
|
{% call text() %}
|
||||||
Looking to hear back from you.
|
Don't hesitate to get in touch with us if you need more information.
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call text() %}
|
{% call text() %}
|
||||||
|
|
|
@ -14,5 +14,5 @@ If that’s the case, please disable the alias instead if you don't want to rece
|
||||||
|
|
||||||
If SimpleLogin isn’t useful for you, please know that you can simply delete your account on the Settings page.
|
If SimpleLogin isn’t useful for you, please know that you can simply delete your account on the Settings page.
|
||||||
|
|
||||||
Looking to hear back from you.
|
Don't hesitate to get in touch with us if you need more information.
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call text() %}
|
{% call text() %}
|
||||||
Looking to hear back from you.
|
Don't hesitate to get in touch with us if you need more information.
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call text() %}
|
{% call text() %}
|
||||||
|
|
Loading…
Reference in a new issue