on
dns
technitium
ubuntu
- Get link
- X
- Other Apps
1. Install postfwd.
sudo apt-get install postfwd
2. Create default postfwd config /etc/postfix/postfwd.cf with below setting.
id=SZ002; protocol_state=END-OF-MESSAGE; action=DUNNO; size<=62914560; sender=abc@mydomain.com
id=SZ003; protocol_state=END-OF-MESSAGE; action=DUNNO; size<=15728640
id=SZ100; protocol_state=END-OF-MESSAGE; action=REJECT Message size $$size exceed fixed limit 10MB
3. Add smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:10040 to /etc/postfix/main.cf.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:10040
myhostname = postfwd.xxx.local
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, postfwd, localhost.localdomain, , localhost
#relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.40.106/32
#mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 125829120
message_size_limit = 62914560
4. Restart both postfix and postfwd and send mail over 10MB.
Nov 15 06:01:50 postfwd postfix/smtpd[6521]: connect from pmg.xxx.local[192.168.40.106]
Nov 15 06:01:50 postfwd postfwd2/policy[6553]: [RULES] rule=1, id=default, client=pmg.xxx.local[192.168.40.106], sender=<lee@xxx.local>, recipient=<xxx@yahoo.com>, helo=<pmg.xxx.local>, proto=ESMTP, state=RCPT, delay=0.00s, hits=default, action=DUNNO
Nov 15 06:01:50 postfwd postfix/smtpd[6521]: BB12560928: client=pmg.xxx.local[192.168.40.106]
Nov 15 06:01:50 postfwd postfix/cleanup[6524]: BB12560928: message-id=<5DCEAFC5020000F80011F345@mail.xxx.local>
Nov 15 06:01:50 postfwd postfwd2/policy[6553]: [RULES] rule=0, id=SZ002, queue=BB12560928, client=pmg.xxx.local[192.168.40.106], sender=<lee@xxx.local>, recipient=<xxx@yahoo.com>, helo=<pmg.xxx.local>, proto=ESMTP, state=END-OF-MESSAGE, delay=0.00s, hits=SZ002, action=REJECT Message size exceed fixed limit 5MB
Nov 15 06:01:50 postfwd postfix/smtpd[6521]: BB12560928: reject: END-OF-MESSAGE from pmg.xxx.local[192.168.40.106]: 554 5.7.1 <END-OF-MESSAGE>: End-of-data rejected: Message size exceed fixed limit 5MB; from=<lee@xxx.local> to=<xxx@yahoo.com> proto=ESMTP helo=<pmg.xxx.local>
Nov 15 06:01:50 postfwd postfix/smtpd[6521]: disconnect from pmg.xxx.local[192.168.40.106] ehlo=1 mail=1 rcpt=1 data=0/1 quit=1 commands=4/5
Nov 15 06:02:05 postfwd postfix/smtpd[6521]: connect from pmg.xxx.local[192.168.40.106]
Nov 15 06:02:05 postfwd postfwd2/policy[6553]: [RULES] rule=1, id=default, client=pmg.xxx.local[192.168.40.106], sender=<lee@xxx.local>, recipient=<xxx@gmail.com>, helo=<pmg.xxx.local>, proto=ESMTP, state=RCPT, delay=0.00s, hits=default, action=DUNNO
Nov 15 06:02:05 postfwd postfix/smtpd[6521]: 265BD60928: client=pmg.xxx.local[192.168.40.106]
Nov 15 06:02:05 postfwd postfix/cleanup[6524]: 265BD60928: message-id=<5DCEAFD3020000F80011F34A@mail.xxx.local>
Nov 15 06:02:05 postfwd postfwd2/policy[6553]: [RULES] rule=1, id=default, queue=265BD60928, client=pmg.xxx.local[192.168.40.106], sender=<lee@xxx.local>, recipient=<xxx@gmail.com>, helo=<pmg.xxx.local>, proto=ESMTP, state=END-OF-MESSAGE, delay=0.00s, hits=default, action=DUNNO
Nov 15 06:02:05 postfwd postfix/qmgr[5741]: 265BD60928: from=<lee@xxx.local>, size=19631063, nrcpt=1 (queue active)
Nov 15 06:02:05 postfwd postfix/smtpd[6521]: disconnect from pmg.xxx.local[192.168.40.106] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Nov 15 06:03:38 postfwd postfix/smtp[6525]: 265BD60928: to=<xxx@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.24.27]:25, delay=93, delays=0.22/0/0.69/92, dsn=2.0.0, status=sent (250 2.0.0 OK 1573797817 r19si7646305pgi.261 - gsmtp)
Nov 15 06:03:38 postfwd postfix/qmgr[5741]: 265BD60928: removed
Comments