Merge pull request #816 from simple-login/feature/include-sender-in-header
Feature/include sender in header
This commit is contained in:
commit
6a520e110c
|
@ -315,6 +315,15 @@ def setting():
|
|||
return redirect(url_for("dashboard.setting"))
|
||||
Session.commit()
|
||||
flash("Your preference has been updated", "success")
|
||||
elif request.form.get("form-name") == "sender-header":
|
||||
choose = request.form.get("enable")
|
||||
if choose == "on":
|
||||
current_user.include_header_email_header = True
|
||||
else:
|
||||
current_user.include_header_email_header = False
|
||||
Session.commit()
|
||||
flash("Your preference has been updated", "success")
|
||||
return redirect(url_for("dashboard.setting"))
|
||||
elif request.form.get("form-name") == "export-data":
|
||||
return redirect(url_for("api.export_data"))
|
||||
elif request.form.get("form-name") == "export-alias":
|
||||
|
|
|
@ -450,6 +450,11 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
|
|||
server_default=BlockBehaviourEnum.return_2xx.name,
|
||||
)
|
||||
|
||||
# to keep existing behavior, the server default is TRUE whereas for new user, the default value is FALSE
|
||||
include_header_email_header = sa.Column(
|
||||
sa.Boolean, default=False, nullable=False, server_default="1"
|
||||
)
|
||||
|
||||
@property
|
||||
def directory_quota(self):
|
||||
return min(
|
||||
|
|
|
@ -801,7 +801,8 @@ def forward_email_to_mailbox(
|
|||
add_or_replace_header(msg, headers.SL_DIRECTION, "Forward")
|
||||
|
||||
msg[headers.SL_EMAIL_LOG_ID] = str(email_log.id)
|
||||
msg[headers.SL_ENVELOPE_FROM] = envelope.mail_from
|
||||
if user.include_header_email_header:
|
||||
msg[headers.SL_ENVELOPE_FROM] = envelope.mail_from
|
||||
# when an alias isn't in the To: header, there's no way for users to know what alias has received the email
|
||||
msg[headers.SL_ENVELOPE_TO] = alias.email
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 4729b7096d12
|
||||
Revises: 9282e982bc05
|
||||
Create Date: 2022-02-25 12:11:10.991810
|
||||
|
||||
"""
|
||||
import sqlalchemy_utils
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4729b7096d12'
|
||||
down_revision = '9282e982bc05'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('include_header_email_header', sa.Boolean(), server_default='1', nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'include_header_email_header')
|
||||
# ### end Alembic commands ###
|
|
@ -520,6 +520,30 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" id="sender-header">
|
||||
<div class="card-body">
|
||||
<div class="card-title">Include original sender in email headers
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
SimpleLogin forwards emails to your mailbox from the <b>reverse-alias</b> and not from the <b>original</b> sender address. <br>
|
||||
If this option is enabled, the original sender addresses is stored in the email header <b>X-SimpleLogin-Envelope-From</b>.
|
||||
You can choose to display this header in your email client. <br>
|
||||
As email headers aren't encrypted, your mailbox service can know the sender address via this header.
|
||||
</div>
|
||||
<form method="post" action="#sender-header">
|
||||
<input type="hidden" name="form-name" value="sender-header">
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" id="include-sender-header" name="enable"
|
||||
{% if current_user.include_header_email_header %} checked {% endif %} class="form-check-input">
|
||||
<label for="include-sender-header">Include sender address in email headers</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-outline-primary">Update</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title">Alias Import</div>
|
||||
|
|
Loading…
Reference in New Issue