Hi again!
About two weeks ago I had my first newbie-question where this list helped me – thank you again! Back then Marcus Merighi recommended that I already make opensmtpd validate if the recipient exists and refuse if he doesn’t. I am having a hard time accomplishing this. I am feeling like I don’t understand some fundamental concepts of opensmtpd but I can’t figure out how to learn them. # Goals 1. I want to get my opensmtpd to get all user and alias information via mysql. (working at least regarding goal 2) 2. I want it to deliver emails from authenticated users via smtp to anywhere. (already working) 3. I want it to take emails for existing users and deliver them via lmtp to dovecot. 4. I want it to take emails for aliases and forward them to the destination both internally and externally. (complete config below) # 3. Deliver to existing users via lmtp I am failing to get a rule to match. Originally I had this rule which should accept all emails for the domains in the table (the wanted user-check was not included): match from any for domain <domains> action "inbound" But that always results in 550 Invalid recipient. Then I rcpt-to and to hardcode one email-address match from any rcpt-to *EMAILADDRESSHERE* action "inbound" but I still get 550 Invalid recipient. Furthermore I am totally confused by the virtual users concept. I don’t really get the difference between user, userbase and virtual and I don’t understand how, if I specify mysql as a table, opensmtpd knows which query from the mysql config-file it should use to get the needed table-items. Logically the syntax should be something like Match from any rcpt-to <virtualusers> action "inbound" and then I should have table domains mysql:/etc/mail/mysql.conf Where I can specify a query that is run with what ever is the real rcpt-to. But that seems to be a big misconception, so how is it right? # 4. Forward for aliases Haven’t even tried yet. I fail to understand how that would work. # smtpd.conf # Variablen setzen ipv4addr = *removed* hostn = mx01.*domainremoved* # komprimiert die Warteschlange, verschlüsselt sie und löscht nach 4 Stunden (optional) #queue compression #queue encryption key "***" #expire 4h # Zertifikate hinzufügen pki mx01.mx.itsmind.dev cert "/etc/ssl/mx01.*domainremoved*.crt" pki mx01.mx.itsmind.dev key "/etc/ssl/private/mx01.*domainremoved*.key" # Relevante Tabellen laden table domains mysql:/etc/mail/mysql.conf table credentials mysql:/etc/mail/mysql.conf table virtuals mysql:/etc/mail/mysql.conf # Zuhören listen on $ipv4addr port smtp tls listen on $ipv4addr smtps pki mx01.*domainremoved* auth <credentials> listen on $ipv4addr port submission tls-require pki mx01.*domainremoved* auth <credentials> # define actions action "inbound" lmtp "mda1:24" action "outbound" relay # define triggers match from any for domain <domains> action inbound #match from any rcpt-to "EMAIL-ADDRESS-HERE" action "inbound" #match for any action "outbound" match auth from any for any action "outbound" # /etc/mail/mysql.conf host XXX username XXX password XXX database XXX query_credentials SELECT email, password FROM virtual_users WHERE email=?; query_domain SELECT name FROM virtual_domains WHERE name=?; #query_userinfo SELECT uid,gid,maildir FROM virtual_users WHERE email=?; query_alias SELECT destination FROM virtual_aliases WHERE source=?; Conclusion Getting started with opensmtpd is acutally extremely hard… but I am happy that there is this mailinglist! Thank you in advance! Kind regards Fabian