Commit Graph

259 Commits

Author SHA1 Message Date
Son NK
01858ac452 sanitize contact email 2021-01-11 12:27:02 +01:00
Son NK
ef7fae32b1 remove the "Hi {name}" from email template 2021-01-11 10:23:34 +01:00
Son NK
3ac159d073 use text/plain for text email instead of text/text 2021-01-04 15:11:12 +01:00
Son NK
3179d70df1 ignore text/csv in replace() 2020-12-31 18:03:42 +01:00
Son NK
a34af98de8 handle "multipart/signed" in add_header() 2020-12-31 15:50:03 +01:00
Son NK
ef2624ccea handle multipart/mixed in add_header 2020-12-31 15:11:46 +01:00
Son NK
74a63db835 ignore "text/directory" in replace() 2020-12-30 09:48:58 +01:00
Son NK
31774f9ea7 set include_sender_in_reverse_alias to False by default 2020-12-28 10:28:05 +01:00
Son NK
3015cd1dc0 ignore "text/calendar" content type 2020-12-18 16:07:32 +01:00
Son NK
6cec373b6d ignore UnicodeDecodeError in decode_text() 2020-12-18 13:10:33 +01:00
Son NK
fb8a43fd5d use decode_text() in add_header() 2020-12-18 10:44:42 +01:00
Son NK
091ff3ad2c Add decode_text() 2020-12-18 10:43:06 +01:00
Son NK
3a8cdce650 Create should_disable 2020-12-16 18:50:09 +01:00
Son Nguyen Kim
bf139f83b3
Merge pull request #342 from herrboyer/linting
Linting
2020-12-07 17:45:50 +01:00
Son NK
ce3dae2a07 inform user when an alias can't be created when a directory is disabled 2020-12-07 10:55:13 +01:00
Son NK
37a74bc093 refactor: rename 2020-12-07 10:50:42 +01:00
Renaud Boyer
5d948faf56 black 2020-12-06 22:11:58 +01:00
Son NK
ce2d68a64d take into account include_sender_in_reverse_alias when creating reverse-alias 2020-12-06 19:37:20 +01:00
Renaud Boyer
4bcc0d107f linting 2020-12-06 18:01:55 +01:00
Son NK
83df119178 do not replace for "application/*" 2020-12-04 11:33:49 +01:00
Son NK
59daaa3164 ignore multipart/signed when replacing message 2020-12-03 17:52:11 +01:00
Son NK
cd680bcd7f ignore content type like image/, video/, audio/ in replace() 2020-12-01 18:34:38 +01:00
Son NK
652bb6a369 take into account multipart/mixed in replace() 2020-11-30 19:45:45 +01:00
Son NK
cefa68d392 Create replace() in email_utils 2020-11-30 15:15:13 +01:00
Son NK
0b95ca33b8 use no encoding for 8bit and binary 2020-11-30 10:49:04 +01:00
Son NK
f804332c2d refactor: create EmailEncoding enum 2020-11-30 10:48:16 +01:00
Son NK
d61f45ea86 use 7bit as default encoding 2020-11-26 17:22:17 +01:00
Son NK
1241838b26 take into account message encoding in add_header() 2020-11-26 17:03:50 +01:00
Son NK
e2a7061429 add get_encoding() and encode_text() 2020-11-26 17:01:05 +01:00
Son NK
bcdf522174 create normalize_reply_email(): handle case where reply email contains space, quote, etc 2020-11-22 13:07:09 +01:00
Son NK
f069d2f083 use getaddresses to parse multiple address from To, CC header. Remove get_addrs_from_header() 2020-11-21 19:15:02 +01:00
Son NK
c25a5b50f6 make sure reply_email only contain lowercase 2020-11-20 10:03:40 +01:00
Son NK
75c3fa1c11 make sure reply-email only uses ascii-encoded char 2020-11-18 15:36:39 +01:00
Son NK
9ca129cb97 use warning level for cannot decode error 2020-11-18 11:43:25 +01:00
Son NK
319078fceb use contact email when generating reply-email 2020-11-18 10:24:39 +01:00
Son NK
0963049d1f use utf-8 when unknown charset in parseaddr_unicode() 2020-11-18 10:03:58 +01:00
Son NK
28d42a7a22 Use get_header_unicode() in get_addrs_from_header() 2020-11-18 10:03:00 +01:00
Son NK
be510ea1d7 use utf-8 if unknown charset in get_header_unicode() 2020-11-18 10:02:10 +01:00
Son NK
9154b4656d refactor: create is_reply_email() 2020-11-16 19:22:19 +01:00
Son NK
75ba1669e0 Create generate_reply_email() and refactor 2020-11-16 19:15:09 +01:00
Son NK
f16676e921 email.message_from_string can also throw LookupError when non-existent charset is set 2020-11-13 18:08:56 +01:00
Son NK
4e16eb7403 fix 2020-11-10 17:42:23 +01:00
Son NK
4666d21f63 email.message_from_string can also throw KeyError when 'content-transfer-encoding' is absent 2020-11-10 17:26:24 +01:00
Son NK
632a5bbbc8 handle UnicodeEncodeError in copy() and to_bytes() 2020-11-10 16:02:19 +01:00
Son NK
c3f73b25b2 decode the subject 2020-11-09 21:16:50 +01:00
Son NK
b2f9479bce failover when ascii encoding fails 2020-11-09 20:58:39 +01:00
Son NK
2cc7cb6a37 use to_bytes instead of .as_bytes() 2020-11-09 17:02:10 +01:00
Son NK
3f8e5d0a8b add more logging 2020-11-08 22:39:49 +01:00
Son NK
e659680875 add_header() 2020-11-07 13:00:12 +01:00
Son NK
72a34e28be add is_valid_email() 2020-11-03 11:09:37 +01:00
Son NK
677f150fef add unsubscribe header to com emails 2020-10-22 10:44:05 +02:00
Son NK
4a32db5b5d rename PublicDomain -> SLDomain 2020-10-15 16:51:07 +02:00
Son NK
0a4fc76b61 optimize import 2020-10-15 16:45:28 +02:00
Son NK
adff510359 use PublicDomain instead if ALIAS_DOMAINS 2020-10-15 16:45:08 +02:00
Son NK
1fcf166c00 small refactor: add should_add_dkim_signature 2020-10-15 16:24:04 +02:00
Son NK
e79522b638 take into account Premium domains 2020-10-15 16:21:31 +02:00
Son NK
805e78cad1 rename email_belongs_to_alias_domains -> email_belongs_to_default_domains 2020-10-14 18:46:05 +02:00
Son NK
8517e7d356 refactor com emails: remove non-uses, move to the right location 2020-09-30 11:51:43 +02:00
Son NK
4b697fc897 parseaddr_unicode: handle case where name is bytes 2020-09-16 17:34:33 +02:00
Son NK
03dfafe1cf handle linebreak in parseaddr_unicode 2020-09-16 17:28:01 +02:00
Son NK
40892f8253 contact email can contain whitespace 2020-09-14 18:21:30 +02:00
Son NK
c6eba9f125 improve welcome email 2020-09-12 14:34:32 +02:00
Son NK
85b87bbacb improve send_email_with_rate_control to use on any day range 2020-08-31 17:32:46 +02:00
Son NK
ffc59a6fad Add check_custom_domain cronjob 2020-08-29 19:05:32 +02:00
Son NK
37a53757eb add send_email_at_most_times 2020-08-27 10:43:30 +02:00
Son NK
fdedc24358 black new version 2020-08-27 10:20:48 +02:00
Son NK
cd687664d1 fix email template 2020-08-25 13:03:34 +02:00
Son Nguyen Kim
637bc569eb
Merge pull request #260 from FabioWidmer/improvements-1
Improvements for Self Hosting & More
2020-08-24 20:16:59 +02:00
Son NK
17c7303fb5 add get_header_from_bounce() 2020-08-24 10:17:22 +02:00
Son NK
dc8c2f403e try to fix Message.as_bytes() by trying different policies 2020-08-21 12:01:11 +02:00
Fabio Widmer
fbb17b1f57
Fix email_utils.py formatting 2020-08-14 16:50:59 +02:00
Fabio Widmer
9fa9dbe821
Fix email_utils.py formatting 2020-08-14 16:30:43 +02:00
Fabio Widmer
9226492f83
More self hosting improvements 2020-08-14 16:23:29 +02:00
Son NK
38a6bcc461 add warning log 2020-07-23 11:32:11 +02:00
Son NK
d89e41d0e5 use user.max_spam_score if present 2020-07-23 11:11:43 +02:00
Son NK
4906d3a4a8 add more logging in email_domain_can_be_used_as_mailbox 2020-06-14 12:00:02 +02:00
Son NK
5705842415 add email_utils.copy() 2020-06-12 00:02:07 +02:00
Son NK
d0c65ea378 send transactional email from SENDER if set 2020-06-10 13:55:47 +02:00
Son NK
b47d95226d generate html from plaintext if not set 2020-06-10 12:18:39 +02:00
Son NK
0c4e48c906 remove bounced_email param from send_email_with_rate_control 2020-06-10 12:17:04 +02:00
Son NK
da7b46ef97 remove bounced_email param from send_email 2020-06-10 12:15:57 +02:00
Son NK
b356ea1b28 force convert header to string, sometimes addrs is Header object 2020-06-01 21:14:23 +02:00
Son NK
a512fbc6e5 use POSTFIX_PORT instead of 25 if it's set 2020-05-21 20:43:12 +02:00
Son NK
6cc8dd548c use warning level for "emails were sent to in the last 24h" error 2020-05-21 20:07:04 +02:00
Son NK
2978bfb281 Fix user cannot change personal email back and better naming.
Happens when user
- changes their personal email
- wants to change back: they can't as this email is already used as mailbox
2020-05-15 23:18:30 +02:00
Son NK
3a1af9f424 fall back for UnicodeDecodeError 2020-05-14 13:27:04 +02:00
Son NK
9ddb8ff2d4 add more info to spf alert email. Set the max number of emails per 24h to 1 2020-05-10 10:37:56 +02:00
Son NK
ac6d1c1106 able to set nb max alert in send_email_with_rate_control 2020-05-10 10:34:39 +02:00
Son NK
d9f1fb9130 Create send_email_with_rate_control(): same as send_email() but with rate control 2020-05-09 20:43:17 +02:00
Son NK
c85ea1538e Allow the same mailbox used by different user 2020-05-07 21:47:11 +02:00
Son NK
16de59a9f5 mailbox can be other user's email 2020-05-06 12:34:52 +02:00
Son NK
6acbf2f8dc do not accept email without MX record 2020-04-27 23:08:34 +02:00
Son NK
acacab887e Check MX record of email domain to see if it is disposed 2020-04-27 18:17:50 +02:00
Son NK
cf016caa91 Refuse disposable emails in can_be_used_as_personal_email() 2020-04-16 09:43:14 +02:00
Son NK
a548c84694 Make MAX_NB_EMAIL_FREE_PLAN available in all email templates 2020-04-08 23:06:56 +02:00
Son NK
afceabeef5 add Contact.new_addr() 2020-04-05 15:21:04 +02:00
Son NK
c686767d4d Fix parseaddr_unicode: take into account email only case 2020-04-05 12:56:17 +02:00
Son NK
6c68b3cda7 Fix website_send_to: prefer using name instead of website_from 2020-04-05 12:48:59 +02:00
Son NK
5fff1e86ce Add parseaddr_unicode() 2020-04-05 12:07:40 +02:00
Son NK
55190ff358 use msg.as_bytes() instead of msg.as_string().encode() 2020-04-02 21:30:36 +02:00
Son NK
9500cc6cee Take into account spamassassin spam report 2020-03-30 22:05:31 +02:00
Son NK
7f49312255 use user preferred sender format 2020-03-28 22:37:00 +01:00
Son NK
aa3a13c3ca Replace To or CC header when forward/reply 2020-03-28 19:16:55 +01:00
Son NK
4f281bdbbb rename GenEmail -> Alias, gen_email to alias whenever possible 2020-03-17 11:51:40 +01:00
Son NK
027cbb10d9 use parseaddr instead of get_email_part 2020-03-15 22:32:48 +01:00
Son NK
6b6fca2281 use email.utils.parseaddr and formataddr instead of get_email_name 2020-03-15 22:29:53 +01:00
Son NK
69198ff08a delete all unnecessary headers in PGP 2020-03-14 22:24:02 +01:00
Son NK
0bb9830680 Store the bounced email in email handling. 2020-03-14 16:34:23 +01:00
Son NK
fac833b8e6 support the case user wants to re-add their real email as mailbox 2020-03-08 10:05:13 +01:00
Son NK
b15eeb10c5 If POSTFIX_SUBMISSION_TLS, use port 587 2020-03-03 10:49:27 +01:00
Son NK
6615631b4e improve logging 2020-02-23 14:38:53 +07:00
Son NK
85eca009ac send_email accepts bounced_email (optional) param 2020-02-22 20:39:45 +07:00
Son NK
fc09f911a4 refactor email-handler: extract try_auto_create() 2020-02-19 22:15:27 +07:00
Son NK
7598a167d0 Improve emails that inform unauthorized user 2020-02-11 22:58:30 +07:00
Son NK
b41a61165c use mailbox_email when notifying user attempt to send from his alias 2020-02-11 22:46:53 +07:00
Son NK
821372fdfd add email_already_used() and use it when creating user 2020-02-10 23:16:30 +07:00
Son NK
1086275af3 add_dkim_signature: make sure to delete DKIM-Signature header before 2020-02-07 22:04:27 +07:00
Son NK
dec36ceeec Fix add_or_replace_header: make sure to delete all header occurrences before 2020-02-07 22:04:27 +07:00
Son NK
4c383663f4 Fix delete_header not deleting all header occurences 2020-02-07 22:04:27 +07:00
Son NK
1c960f7c33 rename _render -> render 2020-02-03 13:47:34 +07:00
Son NK
55dcf9e6a2 black format 2020-02-03 13:47:13 +07:00
Son NK
9dd7698636 organize emails into transactional/ and com/ 2020-02-03 13:47:13 +07:00
Son NK
8da4557325 send trial ending reminder when trial ends in 2-3 days 2020-01-30 14:19:09 +07:00
Son NK
01abc48f62 add trial information into welcome email 2020-01-30 13:54:33 +07:00
Son NK
86b2e3eb77 fix formatting 2020-01-28 09:31:47 +07:00
Son NK
4dfa45886e add SUPPORT_NAME param 2020-01-28 09:29:04 +07:00
Son NK
fc7a832969 add can_be_used_as_personal_email() 2020-01-25 22:40:30 +07:00
Son NK
00dac9a95a notify user if reply from alias is NOT sent from their personal email 2020-01-22 23:18:27 +01:00
Son NK
d7ed0d77bd add email_belongs_to_alias_domains() to verify if an email belongs to one of the alias domains 2020-01-22 10:24:17 +01:00
Son NK
a03db0d129 create email templates 2020-01-16 22:27:45 +01:00
Son NK
3f0aae6f02 send email notifying user that alias creation works only in premium plan 2020-01-16 22:06:36 +01:00
Son NK
d5dd46f4b1 Fix email title as name now can be empty 2020-01-11 22:33:25 +01:00
Son NK
434f82a244 fix formatting 2020-01-08 12:58:34 +01:00
Son NK
0300d38f56 make sure delete_header() delete all headers occurences 2020-01-08 12:42:25 +01:00
Son NK
27b9312057 fix formatting 2020-01-07 19:50:36 +01:00
Son NK
ba46d8f7e0 add delete_header() 2020-01-07 19:49:26 +01:00
Son NK
44527c6c4e fix annotation on email_utils 2020-01-07 19:47:26 +01:00
Son NK
3bca9fde6b refactor: move add_or_replace_header to email_utils 2020-01-07 19:46:57 +01:00
Son NK
b9908a16b2 add get_email_local_part(), get_email_domain_part() to email_utils 2019-12-30 18:18:10 +01:00
Tung Nguyen
4f751e5cd2 fix typos and improve messages showing at the end users 2019-12-26 13:00:17 +00:00
Son NK
ea1492904a only print out plaintext when NOT_SEND_EMAIL 2019-12-22 15:58:07 +00:00
Son NK
4799721667 remove DKIM-Signature if any 2019-12-17 19:06:17 +02:00
Son NK
a61b900675 Sign DKIM at app level
- add DKIM_PRIVATE_KEY_PATH param
- create email_utils.add_dkim_signature
- add DKIM signature for transactional emails
- add DKIM signature for forward & reply emails. In reply phase, only non-custom-domain emails have DKIM added.
2019-12-17 18:50:26 +02:00
Son NK
f8293bc618 make ADMIN_EMAIL optional 2019-12-16 19:36:59 +02:00
Son NK
62e0ae27a0 move get_email_name, get_email_part to email_utils 2019-12-15 18:55:18 +02:00
Son NK
9dd4a4afb7 take into account NOT_SEND_EMAIL param 2019-12-15 18:55:17 +02:00
Son NK
2ec89afac2 add ADMIN_EMAIL and send notif to this email 2019-12-15 18:55:15 +02:00
Son NK
019aae24f3 Activation email: use base template, change wording. 2019-12-15 18:55:15 +02:00
Son NK
34cf72eaee create POSTFIX server 2019-12-15 18:55:15 +02:00
Son NK
be6266fb0e create change-email email 2019-12-15 18:55:15 +02:00