Hello,
I'd say that all depends on the function/library you're using in your
PHP application to send mails.
The `mail()` command, for instance, uses the `sendmail` binary to
directly ingest your message in your local mail spool, and thus does not
require any authentication. The mail is sent on behalf of the identity
your web server runs under. There's options to set the appropriate
sender in the message headers, obviously.
If you're using a library such as `PHPMailer`, you'll want to use the
SMTP protocol, either locally (on lo0) (1), or remotely (on your mail
provider's SMTP service) (2).
It's up to you to define if you want authentication on the loopback port
(but that's better to do so).
If you're using your local MTA to send emails (1), either using the SMTP
protocol on lo0 or the `sendmail` binary, there's chances you'll want to
use a relay host to avoid being blacklisted by your recipients servers
(or you should take care to have a resolvable public IP with correct SPF
configured in your DNS). Such a configuration has been very well
illustrated by Michael below.
I hope I correctly understood your question and I'm clear enough.
Regards.
Le 04/03/18 à 18:21, Michael Hekeler a écrit :
Am Sun, 01 Apr 2018 17:28:29 +0200
schrieb Markus Rosjat <ros...@ghweb.de>:
Hi there,
There are simple ways of relaying local mails(connection on lo0 on
port 25) to a other mailserver. This is oky for logs and stuff but
what's about mails created by a php on the local webserver? His do I
get smtpd to still do a auth with username and pwd on lo0? Is it
possible or do I need to configure the "external" addr too for this
purpose?
Hello Markus,
I am not sure if I understand your question...
But to relay emails on an internal webserver you have to set the
following 2 lines in /etc/mail/smtpd.conf:
table passwd file:/etc/mail/secrets
accept from any \
for any \
relay via tls+auth://foo@mailserver auth <passwd>
and in /etc/mail/secrets:
foo username:passwword
Thats all. Simple.