Hello all!
I have a server running dovecot & postfix. I have a user on my server who is sending email via smtp on an HP printer and because of that, a copy of the email is not placed in the sent folder like usually happens with clients like outlook and thunderbird.
Is there any way to have the sent emails copied to the sent folder for just this user on my server?
Thx!
Austin Witmer
On 6/17/22 07:33, Austin Witmer wrote:
Hello all!
I have a server running dovecot & postfix. I have a user on my server who is sending email via smtp on an HP printer and because of that, a copy of the email is not placed in the sent folder like usually happens with clients like outlook and thunderbird.
Is there any way to have the sent emails copied to the sent folder for just this user on my server?
Thx!
Austin Witmer
On the postfix side, use sender_bcc_maps to add a user+sent@domain recipient. This will send the message back as an incoming message to the user, with the +sent address detail.
On the receiving end, use sieve to check for the +sent address detail, mark as read and file into the Sent folder.
See below.
On Jun 16, 2022, at 8:50 PM, Gedalya gedalya@gedalya.net wrote:
On 6/17/22 07:33, Austin Witmer wrote:
Hello all!
I have a server running dovecot & postfix. I have a user on my server who is sending email via smtp on an HP printer and because of that, a copy of the email is not placed in the sent folder like usually happens with clients like outlook and thunderbird.
Is there any way to have the sent emails copied to the sent folder for just this user on my server?
Thx!
Austin Witmer
On the postfix side, use sender_bcc_maps to add a user+sent@domain recipient. This will send the message back as an incoming message to the user, with the +sent address detail. Do I add this to my postfix main.cf file and what is the exact syntax? Will this affect all users or just this user?
On the receiving end, use sieve to check for the +sent address detail, mark as read and file into the Sent folder. I already have sieve set up, so this part should be easy.
On 6/17/22 12:29, Austin Witmer wrote:
Do I add this to my postfix main.cf file and what is the exact syntax? Yes, e.g.: sender_bcc_maps = hash:/etc/postfix/back-to-sent-folder
/etc/postfix/back-to-sent-folder : (simple key-value) user@domain user+sent@domain
hash the file with: postmap back-to-sent-folder this will create back-to-sent-folder.db which is what postfix will actually look at
Will this affect all users or just this user?
The content of the file determines that.
For details: https://www.postfix.org/postconf.5.html#sender_bcc_maps
In this example, we have only one line affecting only one user.
The data can be taken from other sources, including SQL database:
Thank you so much for the detailed info! I really appreciate it!
I think I’ve got this working now how I want it.
Austin Witmer
On Jun 16, 2022, at 11:52 PM, Gedalya gedalya@gedalya.net wrote:
On 6/17/22 12:29, Austin Witmer wrote:
Do I add this to my postfix main.cf file and what is the exact syntax? Yes, e.g.: sender_bcc_maps = hash:/etc/postfix/back-to-sent-folder
/etc/postfix/back-to-sent-folder : (simple key-value) user@domain user+sent@domain
hash the file with: postmap back-to-sent-folder this will create back-to-sent-folder.db which is what postfix will actually look at
Will this affect all users or just this user?
The content of the file determines that.
For details: https://www.postfix.org/postconf.5.html#sender_bcc_maps
In this example, we have only one line affecting only one user.
The data can be taken from other sources, including SQL database:
Now I’ve run into a bit of a problem . . . For some reason I am now getting five duplicate emails placed in my sent folder! I have the email client I am testing with set to not place a copy in the sent folder, so none of those are being synced to my sent folder by my email client.
How do I ensure that the email only gets placed in my sent folder once?
Thanks!
Austin Witmer
On Jun 16, 2022, at 11:52 PM, Gedalya gedalya@gedalya.net wrote:
On 6/17/22 12:29, Austin Witmer wrote:
Do I add this to my postfix main.cf file and what is the exact syntax? Yes, e.g.: sender_bcc_maps = hash:/etc/postfix/back-to-sent-folder
/etc/postfix/back-to-sent-folder : (simple key-value) user@domain user+sent@domain
hash the file with: postmap back-to-sent-folder this will create back-to-sent-folder.db which is what postfix will actually look at
Will this affect all users or just this user?
The content of the file determines that.
For details: https://www.postfix.org/postconf.5.html#sender_bcc_maps
In this example, we have only one line affecting only one user.
The data can be taken from other sources, including SQL database:
On 6/17/22 22:18, Austin Witmer wrote:
Now I’ve run into a bit of a problem . . . For some reason I am now getting five duplicate emails placed in my sent folder! I have the email client I am testing with set to not place a copy in the sent folder, so none of those are being synced to my sent folder by my email client.
Is it possible that the message is routed outwards and then in again somehow?
Each time a message with the sender address user@domain comes in, the extra recipient will be added. You could easily get into a loop.
What client is being used?
For this kind of thing in Thunderbird we right click on the folder with duplicates > properties > repair folder (button)
On 6/17/2022 12:00 PM, Gedalya wrote:
On 6/17/22 22:18, Austin Witmer wrote:
Now I’ve run into a bit of a problem . . . For some reason I am now getting five duplicate emails placed in my sent folder! I have the email client I am testing with set to not place a copy in the sent folder, so none of those are being synced to my sent folder by my email client. Is it possible that the message is routed outwards and then in again somehow?
Each time a message with the sender address user@domain comes in, the extra recipient will be added. You could easily get into a loop.
-- Christopher Wensink IS Administrator Five Star Plastics, Inc 1339 Continental Drive Eau Claire, WI 54701 Office: 715-831-1682 Mobile: 715-563-3112 Fax: 715-831-6075 cwensink@five-star-plastics.com www.five-star-plastics.com
I believe my client is using an iPhone to check mail on this address. The interesting thing is that it seems like apple mail clients don’t show the duplicate messages like thunderbird does. I don’t like the idea of the unnecessary emails piling up. Are you saying that doing a repair on a folder in thunderbird will delete the duplicate messages?
Doing an ls /maildir/user/.Sent/cur folder shows the duplicate messages. It seems like postfix is bccing the outgoing message more than once somehow.
Maybe I need to take this conversation over to the postfix mailing list?
Austin Witmer
On Jun 17, 2022, at 11:21 AM, Christopher Wensink cwensink@five-star-plastics.com wrote:
What client is being used?
For this kind of thing in Thunderbird we right click on the folder with duplicates > properties > repair folder (button)
On 6/17/2022 12:00 PM, Gedalya wrote:
On 6/17/22 22:18, Austin Witmer wrote:
Now I’ve run into a bit of a problem . . . For some reason I am now getting five duplicate emails placed in my sent folder! I have the email client I am testing with set to not place a copy in the sent folder, so none of those are being synced to my sent folder by my email client. Is it possible that the message is routed outwards and then in again somehow?
Each time a message with the sender address user@domain comes in, the extra recipient will be added. You could easily get into a loop.
-- Christopher Wensink IS Administrator Five Star Plastics, Inc 1339 Continental Drive Eau Claire, WI 54701 Office: 715-831-1682 Mobile: 715-563-3112 Fax: 715-831-6075 cwensink@five-star-plastics.com www.five-star-plastics.com
I am saying that when I have this issue with duplicate messages in Thunderbird, the repair takes care of that. I honestly haven't checked the quantity of messages on the server to see if the issue was there before, or after the fix, you could try that fix.
This may be completely unrelated but back in the day I've seen this type of issue on machines using outlook when the .pst file is full and hit it's max size, or the computer running it runs out of hard drive space. That's something else to check.
Chris
On 6/17/2022 1:48 PM, Austin Witmer wrote:
I believe my client is using an iPhone to check mail on this address. The interesting thing is that it seems like apple mail clients don’t show the duplicate messages like thunderbird does. I don’t like the idea of the unnecessary emails piling up. Are you saying that doing a repair on a folder in thunderbird will delete the duplicate messages?
Doing an ls /maildir/user/.Sent/cur folder shows the duplicate messages. It seems like postfix is bccing the outgoing message more than once somehow.
Maybe I need to take this conversation over to the postfix mailing list?
Austin Witmer
On Jun 17, 2022, at 11:21 AM, Christopher Wensink cwensink@five-star-plastics.com wrote:
What client is being used?
For this kind of thing in Thunderbird we right click on the folder with duplicates > properties > repair folder (button)
On 6/17/2022 12:00 PM, Gedalya wrote:
On 6/17/22 22:18, Austin Witmer wrote:
Now I’ve run into a bit of a problem . . . For some reason I am now getting five duplicate emails placed in my sent folder! I have the email client I am testing with set to not place a copy in the sent folder, so none of those are being synced to my sent folder by my email client. Is it possible that the message is routed outwards and then in again somehow?
Each time a message with the sender address user@domain comes in, the extra recipient will be added. You could easily get into a loop.
-- Christopher Wensink IS Administrator Five Star Plastics, Inc 1339 Continental Drive Eau Claire, WI 54701 Office: 715-831-1682 Mobile: 715-563-3112 Fax: 715-831-6075 cwensink@five-star-plastics.com www.five-star-plastics.com
-- Christopher Wensink IS Administrator Five Star Plastics, Inc 1339 Continental Drive Eau Claire, WI 54701 Office: 715-831-1682 Mobile: 715-563-3112 Fax: 715-831-6075 cwensink@five-star-plastics.com www.five-star-plastics.com
On 6/18/22 02:48, Austin Witmer wrote:
It seems like postfix is bccing the outgoing message more than once somehow.
Plausible, and if that's happening the logs should clearly show that.
If your delivery destinations are properly configured, it should just deliver locally, and it should not bcc the bcc ...
And yes this is rather a postfix issue, if the logs confirm that.
On 17.06.22 20:48, Austin Witmer wrote:
Doing an ls /maildir/user/.Sent/cur folder shows the duplicate messages. It seems like postfix is bccing the outgoing message more than once somehow.
That may happen - Postfix cannot check for duplicates. So ...
Maybe I need to take this conversation over to the postfix mailing list?
... no. ;-)
You can solve this problem with the duplicate extension of Pigeonhole Sieve:
https://doc.dovecot.org/configuration_manual/sieve/extensions/duplicate/ https://doc.dovecot.org/settings/pigeonhole-ext/duplicate/ https://datatracker.ietf.org/doc/html/rfc7352#section-5.1
HTH and kind regards, Markus
On 18.06.22 12:33, Gedalya wrote:
On 6/17/22 22:18, Austin Witmer wrote:
For some reason I am now getting five duplicate emails placed in my sent folder
You want to apply this rule only once, perhaps on the way back in from amavisd. This can probably be accomplished by applying the sender_bcc_maps to a specific listener in master.cf, for the general idea see examples here:
If it's a usual Amavis setup then there should be an additional smtpd process listening on port 10026 for example. And there Austin could use:
-o receive_override_options=no_address_mappings
to selectively turn off automatic BCC recipients as stated in:
@Austin: you could send us the output of 'postconf -M' so we could have a look at your master.cf just to be sure.
Kind regards, Markus
On 2022-06-18 14:16, Gedalya wrote:
On 6/18/22 19:47, Markus Winkler wrote:
selectively turn off automatic BCC recipients
Or you could just as well set -o sender_bcc_maps=hash:/etc/postfix/back-to-sent-folder selectively for the submission port, or for port 10026. If this setting is potentially troublesome it might be more future-proof to apply it selectively, rather than selectively override it.
just remember not to add this to port 25 !
for amavisd and postfix go with policy banks MYNETS, not need to use another ports from postfix to amavisd
Here is the output of postconf -M:
Austin Witmer
pickup unix n - y 60 1 pickup cleanup unix n - y - 0 cleanup qmgr unix n - n 300 1 qmgr tlsmgr unix - - y 1000? 1 tlsmgr rewrite unix - - y - - trivial-rewrite bounce unix - - y - 0 bounce defer unix - - y - 0 bounce trace unix - - y - 0 bounce verify unix - - y - 1 verify flush unix n - y 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - y - - smtp relay unix - - y - - smtp -o syslog_name=postfix/$service_name showq unix n - y - - showq error unix - - y - - error retry unix - - y - - error discard unix - - y - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - y - - lmtp anvil unix - - y - 1 anvil scache unix - - y - 1 scache postlog unix-dgram n - n - 1 postlogd smtp inet n - - - - smtpd -o content_filter=gpgit-pipe -o cleanup_service_name=subcleanup submission inet n - n - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING -o smtpd_sasl_type=dovecot -o smtpd_sasl_path=private/auth -o content_filter=gpgit-pipe -o cleanup_service_name=subcleanup -o smtpd_enforce_tls=yes smtps inet n - - - - smtpd -o syslog_name=postfix/smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING -o content_filter=gpgit-pipe -o cleanup_service_name=subcleanup dovecot unix - n n - - pipe flags=DRhu user=email:email argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} policy-spf unix - n n - - spawn user=nobody argv=/usr/bin/policyd-spf maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - n n - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix - n n - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} amavis unix - - - - 2 smtp -o smtp_send_xforward_command=yes -o smtp_tls_security_level=none -o cleanup_service_name=subcleanup -o receive_override_options=no_address_mappings 127.0.0.1:10025 inet n - - - - smtpd -o content_filter= -o receive_override_options=no_milters gpgit-pipe unix - n n - - pipe flags=Rq user=gpgit argv=/var/opt/gpgit/gpgit_postfix.sh -oi -f ${sender} ${recipient} subcleanup unix n - - - 0 cleanup -o header_checks=pcre:/etc/postfix/smtp_header_checks.pcre
On Jun 18, 2022, at 5:47 AM, Markus Winkler ml@irmawi.de wrote:
On 18.06.22 12:33, Gedalya wrote:
On 6/17/22 22:18, Austin Witmer wrote:
For some reason I am now getting five duplicate emails placed in my sent folder You want to apply this rule only once, perhaps on the way back in from amavisd. This can probably be accomplished by applying the sender_bcc_maps to a specific listener in master.cf, for the general idea see examples here:
If it's a usual Amavis setup then there should be an additional smtpd process listening on port 10026 for example. And there Austin could use:
-o receive_override_options=no_address_mappings
to selectively turn off automatic BCC recipients as stated in:
@Austin: you could send us the output of 'postconf -M' so we could have a look at your master.cf just to be sure.
Kind regards, Markus
Thanks to all of you for your help and suggestions!
My setup seems to be working not that I have added the "-o receive_override_options=no_address_mappings” to all but one of the delivery stages in the postfix master.cf file.
Austin Witmer
On Jun 18, 2022, at 9:15 AM, Austin Witmer austin96@emypeople.net wrote:
Here is the output of postconf -M:
Austin Witmer
pickup unix n - y 60 1 pickup cleanup unix n - y - 0 cleanup qmgr unix n - n 300 1 qmgr tlsmgr unix - - y 1000? 1 tlsmgr rewrite unix - - y - - trivial-rewrite bounce unix - - y - 0 bounce defer unix - - y - 0 bounce trace unix - - y - 0 bounce verify unix - - y - 1 verify flush unix n - y 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - y - - smtp relay unix - - y - - smtp -o syslog_name=postfix/$service_name showq unix n - y - - showq error unix - - y - - error retry unix - - y - - error discard unix - - y - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - y - - lmtp anvil unix - - y - 1 anvil scache unix - - y - 1 scache postlog unix-dgram n - n - 1 postlogd smtp inet n - - - - smtpd -o content_filter=gpgit-pipe -o cleanup_service_name=subcleanup submission inet n - n - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING -o smtpd_sasl_type=dovecot -o smtpd_sasl_path=private/auth -o content_filter=gpgit-pipe -o cleanup_service_name=subcleanup -o smtpd_enforce_tls=yes smtps inet n - - - - smtpd -o syslog_name=postfix/smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING -o content_filter=gpgit-pipe -o cleanup_service_name=subcleanup dovecot unix - n n - - pipe flags=DRhu user=email:email argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} policy-spf unix - n n - - spawn user=nobody argv=/usr/bin/policyd-spf maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - n n - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix - n n - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} amavis unix - - - - 2 smtp -o smtp_send_xforward_command=yes -o smtp_tls_security_level=none -o cleanup_service_name=subcleanup -o receive_override_options=no_address_mappings 127.0.0.1:10025 inet n - - - - smtpd -o content_filter= -o receive_override_options=no_milters gpgit-pipe unix - n n - - pipe flags=Rq user=gpgit argv=/var/opt/gpgit/gpgit_postfix.sh -oi -f ${sender} ${recipient} subcleanup unix n - - - 0 cleanup -o header_checks=pcre:/etc/postfix/smtp_header_checks.pcre
On Jun 18, 2022, at 5:47 AM, Markus Winkler ml@irmawi.de wrote:
On 18.06.22 12:33, Gedalya wrote:
On 6/17/22 22:18, Austin Witmer wrote:
For some reason I am now getting five duplicate emails placed in my sent folder You want to apply this rule only once, perhaps on the way back in from amavisd. This can probably be accomplished by applying the sender_bcc_maps to a specific listener in master.cf, for the general idea see examples here:
If it's a usual Amavis setup then there should be an additional smtpd process listening on port 10026 for example. And there Austin could use:
-o receive_override_options=no_address_mappings
to selectively turn off automatic BCC recipients as stated in:
@Austin: you could send us the output of 'postconf -M' so we could have a look at your master.cf just to be sure.
Kind regards, Markus
On 6/16/2022 7:33 PM, Austin Witmer wrote
Hello all!
I have a server running dovecot & postfix. I have a user on my server who is sending email via smtp on an HP printer and because of that, a copy of the email is not placed in the sent folder like usually happens with clients like outlook and thunderbird.
Is there any way to have the sent emails copied to the sent folder for just this user on my server?
Doesn't dovecot now have the ability to be set up as a submission service, and automatically place copies of sent messages to the Sent folder?
I could have sworn I saw this capability added a long time ago...
On 6/19/22 22:16, Tanstaafl wrote:
Doesn't dovecot now have the ability to be set up as a submission service, and automatically place copies of sent messages to the Sent folder?
I could have sworn I saw this capability added a long time ago...
https://doc.dovecot.org/admin_manual/submission_server/
That's when you upload the message to the IMAP Sent folder first, and then ask the server to pick it up from there and send it. This requires special client support.
participants (6)
-
Austin Witmer
-
Benny Pedersen
-
Christopher Wensink
-
Gedalya
-
Markus Winkler
-
Tanstaafl