0

I have written a tool in PHP (on Linux) sendmail mails via mail() (unfortuenately PHPMailer is not an option due do missing support for some required stuff).

PHP ignores all SMTP settings on linux so that it uses the sendmail_path setting.

But when sending mail via mail() -> /usr/sbin/sendmail this leads to mail to be delivered locally (the sending server is also the delivering).

But I MUST have a regular "Received from..." header as it would occur when a mail comes in via regular SMTP (this is required by some filtering passing after it on which I have no access / options to change).

So my question is: Is there any chance to "force" /usr/sbin/sendmail to have the mail passed via SMTP to Postfix instead of putting it into the "deliver" process directly?

I already tried alternatives to /usr/sbin/sendmail like msmtp, but my OS does not allow both to co-exist, and I cannot remove Postfix for that.

Any help is highly appreciated :-D

1
  • sendmail_path can use /usr/bin/msmtp instead of /usr/bin/sendmail. AFAIK msmtp is "semdmail command line compatible" regarding basic email sending options. Commented Nov 21, 2023 at 19:49

1 Answer 1

0

Option (1): Insert your own Received: header in the message, along with Subject:.

Option (2): Configure a new smarthost SMTP relay server, and hop your messages through that machine.

Option (3): Write php code which connects to port 25 and sends a few simple verbs: EHLO, MAIL FROM, RCPT TO, DATA.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.