Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello everybody, hope you're all ok.
Even if this is my first topic here, I'm not new in the linux world.
I can manage myself most of the times with the documentation and net searches but sometimes not, like this time and I'm sorry for that. I'm still an "amateur".
I just installed a new server, Debian 11 in a VPS and I need to send emails.
I use the services of a relay but I do not understand why I cannot make it work...
I have installed Postfix with ssl, certs, private keys, passwd, etc.
This is the /etc/postfix/main.cf
PHP Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no
# appending .domain is the MUA's job. append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h
readme_directory = no
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on # fresh installs. compatibility_level = 2
All the files /etc/ssl/certs/ssl-cert-snakeoil.pem, /etc/ssl/private/ssl-cert-snakeoil.key, /etc/ssl/certs/ca-certificates.crt, /etc/ssl/certs/server.crt, /etc/ssl/private/server.key are well placed, and the /etc/postfix/sasl/sasl_passwd is in place with the right data and postmaped ok.
The relayhost is well defined: relayhost = [smtp.netcorecloud.net]:587 and I have no firewall enabled to disturb.
But when I try to send a mail I have this log:
Quote:
Apr 19 01:32:17 server postfix/pickup[5253]: 6EE582028E: uid=0 from=<root>
Apr 19 01:32:17 server postfix/cleanup[5258]: 6EE582028E: message-id=<20240418233217.6EE582028E@server.ovh.net>
Apr 19 01:32:17 server postfix/qmgr[5254]: 6EE582028E: from=<root@domain.com>, size=280, nrcpt=1 (queue active)
Apr 19 01:32:17 server postfix/local[5260]: 6EE582028E: to=<mail.address@dom.com>, relay=local, delay=18, delays=18/0.01/0/0.02, dsn=5.1.1, status=bounced (unknown user: "mail.address")
Apr 19 01:32:17 server postfix/cleanup[5258]: 7A82B2028F: message-id=<20240418233217.7A82B2028F@server.ovh.net>
Apr 19 01:32:17 server postfix/qmgr[5254]: 7A82B2028F: from=<>, size=2205, nrcpt=1 (queue active)
Apr 19 01:32:17 server postfix/bounce[5261]: 6EE582028E: sender non-delivery notification: 7A82B2028F
Apr 19 01:32:17 server postfix/qmgr[5254]: 6EE582028E: removed
Apr 19 01:32:17 server postfix/local[5260]: 7A82B2028F: to=<root@domain.com>, relay=local, delay=0.01, delays=0.01/0/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)
Apr 19 01:32:17 server postfix/qmgr[5254]: 7A82B2028F: removed
-> Postfix is working on local and refuse to send by smtp.
I think I should have to have this type of log, as I have in another server, using, curiouly the same configuration and the same relay:
Quote:
Apr 18 13:30:12 server postfix/pickup[257816]: D8A6AA1709: uid=33 from=<www-data>
Apr 18 13:30:12 server postfix/cleanup[258156]: D8A6AA1709: message-id=<20240418173012.D8A6AA1709@server.vps.ovh.ca>
Apr 18 13:30:12 server postfix/qmgr[204252]: D8A6AA1709: from=<www-data@pukanina.asouka.com>, size=6206, nrcpt=2 (queue active)
Apr 18 13:30:13 server postfix/smtp[258158]: D8A6AA1709: to=<mail.address@dom.com>, relay=smtp.netcorecloud.net[35.212.37.142]:587, delay=0.41, delays=0.02/0.03/0.32/0.04, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as A83F62A0004)
Apr 18 13:30:13 server postfix/smtp[258158]: D8A6AA1709: to=<pat.boye31@yahoo.fr>, relay=smtp.netcorecloud.net[35.212.37.142]:587, delay=0.41, delays=0.02/0.03/0.32/0.04, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as A83F62A0004)
Apr 18 13:30:13 server postfix/qmgr[204252]: D8A6AA1709: removed
Welcome to Postfix It IS hard to understand. Postfix takes quite a bit of getting used to. For very large mailservers (thousands of users) I would still use Postfix. Otherwise I would, by now, recommend OpenSMTPD, which is MUCH simpler to configure.
I am happy to help you with both, or point you to the right solution, depending on what your goal is.
Your post is a bit confusing:
> I use the services of a relay but I do not understand why I cannot make it work...
That sounds like you want to relay emails to a large provider (gmail) which then delivers it to the final recipient.
> From your config: `permit_sasl_authenticated`
This looks like you are trying to "setup a mailserver" - a server "mail.example.com" where you can SMTP auth with your thunderbird mail client and "send mails".
Hello blunix2,
Thanks for the reply,
I have several web sites, one is an extranet witch send automated mails for my clients, providers or even to my team, and I want to be sure that the mails sended arrive ok to the inboxes, so I decided some years ago to take the services of a relay to be sure that all my emails could arrive ok and not be bounced, rejected, placed on spam folder, etc.
I have a server with postfix configured with this relay, and all works ok and I had to reinstall the other server and reinstall all the applications, firewall, etc, and one of these is postfix.
In fact, I just want my server to send emails through this relay, if this is ok with postfix that's ok for me bue I'm opened to other solutions.
I see that you're talking about OpenSMTPD, I did not know. I'm go to see it now.
I'm not sure I fully understand your approach - but here is mine.
I host a larger number of websites, most of which generate emails like booking confirmations, newsletters and alike.
Each webserver (there are usually a larger number of web-servers (running nginx+php-fpm or something like this) behind a loadbalancer) has a local OpenSMTPD server installed - you can do this with Postfix too but the configuration is much more ugly (imho), which invites errors (readability counts, from the Zen of Python)
So these programs (Postfix or OpenSMTPD) installed on webservers are whats commonly referred to as a mailrelay. On this mailrelay, you setup SMTP credentials for a larger provider, like gmail or office365, the same way you would setup SMTP credentials in your thunderbird to send mails.
Your webapplication then gives all mails to localhost:25. Depending on the mail-from address your webapplication sets, OpenSMTPD (or Postfix) will choose one of the SMTP accounts you setup to relay the email.
This way makes sure that mails don't get lost, because everyone takes mails from gmail and other large players.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.