Merge pull request #197 from SibrenVasse/remove-reply-string
Remove reply string
This commit is contained in:
commit
484aca1342
|
@ -173,7 +173,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title mb-3">Current Plan</div>
|
||||
|
@ -238,6 +237,26 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title">Replace reverse alias</div>
|
||||
<div class="mb-3">
|
||||
When replying to a reverse alias your email client will show the reverse alias ("ra+string@simplelogin.co")
|
||||
as the original sender. This option will replace this string in the body of outgoing emails with the
|
||||
original email address. This will break PGP signed emails, so only enable if you know what you're doing!
|
||||
</div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="form-name" value="replace-ra">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" id="replace-ra" name="replace-ra"
|
||||
{% if current_user.replace_reverse_alias %} checked {% endif %} class="form-check-input">
|
||||
<label for="replace-ra">Enable replacing reverse alias</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-outline-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title">Quarantine</div>
|
||||
|
|
|
@ -160,6 +160,7 @@ def setting():
|
|||
db.session.commit()
|
||||
flash("Your preference has been updated", "success")
|
||||
return redirect(url_for("dashboard.setting"))
|
||||
|
||||
elif request.form.get("form-name") == "change-sender-format":
|
||||
sender_format = int(request.form.get("sender-format"))
|
||||
if SenderFormatEnum.has_value(sender_format):
|
||||
|
@ -169,6 +170,16 @@ def setting():
|
|||
db.session.commit()
|
||||
return redirect(url_for("dashboard.setting"))
|
||||
|
||||
elif request.form.get("form-name") == "replace-ra":
|
||||
choose = request.form.get("replace-ra")
|
||||
if choose == "on":
|
||||
current_user.replace_reverse_alias = True
|
||||
else:
|
||||
current_user.replace_reverse_alias = False
|
||||
db.session.commit()
|
||||
flash("Your preference has been updated", "success")
|
||||
return redirect(url_for("dashboard.setting"))
|
||||
|
||||
elif request.form.get("form-name") == "export-data":
|
||||
data = {
|
||||
"email": current_user.email,
|
||||
|
|
|
@ -194,6 +194,10 @@ class User(db.Model, ModelMixin, UserMixin):
|
|||
db.Integer, default="1", nullable=False, server_default="1"
|
||||
)
|
||||
|
||||
replace_reverse_alias = db.Column(
|
||||
db.Boolean, default=False, nullable=False, server_default="0"
|
||||
)
|
||||
|
||||
referral_id = db.Column(
|
||||
db.ForeignKey("referral.id", ondelete="SET NULL"), nullable=True, default=None
|
||||
)
|
||||
|
|
|
@ -563,10 +563,17 @@ def handle_reply(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, str
|
|||
if custom_domain.dkim_verified:
|
||||
add_dkim_signature(msg, alias_domain)
|
||||
|
||||
msg_raw = msg.as_string().encode()
|
||||
|
||||
# replace the "ra+string@simplelogin.co" by the alias in the email body
|
||||
# as this is usually included in when replying
|
||||
if user.replace_reverse_alias:
|
||||
msg_raw = msg_raw.replace(reply_email.encode(), alias.email.encode())
|
||||
|
||||
smtp.sendmail(
|
||||
alias.email,
|
||||
contact.website_email,
|
||||
msg.as_bytes(),
|
||||
msg_raw,
|
||||
envelope.mail_options,
|
||||
envelope.rcpt_options,
|
||||
)
|
||||
|
|
29
migrations/versions/2020_051719_ce15cf3467b4_.py
Normal file
29
migrations/versions/2020_051719_ce15cf3467b4_.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: ce15cf3467b4
|
||||
Revises: 659d979b64ce
|
||||
Create Date: 2020-05-17 19:38:30.255689
|
||||
|
||||
"""
|
||||
import sqlalchemy_utils
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ce15cf3467b4'
|
||||
down_revision = '659d979b64ce'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('replace_reverse_alias', sa.Boolean(), server_default='0', nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'replace_reverse_alias')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in a new issue