1

Sometimes I need to send a mail via a sender address which would normally received by a catchall mail address. But the normal method to manipulate the returnmail isn't a nice solution. So I use a "working" scenario with i-MSCP + RoundCube:

  • fixed mailboxes and one catchall
  • If I need to send via a dynamic mail address (will be catched by catchall), I register a mailbox (temporary for this one mail or mailbox+forward) and uses the new credential with RoundCube.

But now I've a minimal server without a management software. I configured postfix with fixed mailboxes and one catchall (regex based + blacklist). Also dovecot works with IMAP and the catchall credential. Beside I can't send a mail via a mail client at the moment (authentification problems), I want a much easier way to send a mail from any address. I don't want register something, just use <dynamic name>@domain.tld and a global password.

My postfix/dovecot:

  • multiple domains
  • no database, only hash and regex files
  • maildir (near standard)
  • no virtual users (catchall has his own unix user)
  • no transport manipulation

What is postfix secret weapon to achieve this send scenario?

my main.cf (login via smtp doesn't work yet, general send and imap are working:

myhostname = domain.tld
smtpd_banner = $myhostname ESMTP $mail_name
biff = no
append_dot_mydomain = no
delay_warning_time = 4h
readme_directory = no

smtpd_tls_cert_file=/etc/letsencrypt/live/domain.tld/cert.pem
smtpd_tls_key_file=/etc/letsencrypt/live/domain.tld/privkey.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_security_level = may
smtpd_tls_auth_only = no
smtpd_tls_received_header = yes
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_protocols = !SSLv2, !SSLv3

smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
smtp_tls_protocols = !SSLv2, !SSLv3

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, domain.tld, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
mynetworks_style = host
home_mailbox = Maildir/
virtual_alias_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/regexp_virtual

smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recipient_access, permit_mynetworks, reject_unauth_destination

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
3
  • Did you try setting up a single (static) account with a password together with different mail addresses? Although usually the mail address is used as user ID, there is no need for those to match for sending mail.
    – Jens Erat
    Apr 13 '17 at 19:36
  • @JensErat OMG, after fixing the sasl auth to use dovecot, I found a uncomment comment (a test option line with a huge of white space which looks like an empty line). Now your suggestion was right, I use the catchall system user credential and any email address. It's so simple, it have to be a basic solution and I failed it. crying in the corner for loosing two days
    – Jonny
    Apr 13 '17 at 21:15
  • Since the comment resolved your issue, I added an answer with some more explanations.
    – Jens Erat
    Apr 17 '17 at 12:40
0

While some mail provider actually enforce the sender address belongs to the authenticated account, this is not generally valid, especially not for the default configuration of Postfix. Actually, it is rather common to use some mail provider as mail relay when hosting servers behind home uplinks with dynamic IP addresses (which are blocked by most black lists because lots of spam is sent from those addresses). I'd guess most don't even enforce the sender domain.

You should be able to authenticate with your catch-all-account's mail address, but configure the account with another sender address. Thunderbird for example also allows to provide multiple identities per SMTP account, which is available for exactly this purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.