[BlueOnyx:01429] Re: 'On behalf of' in the address from Sendmail
Michael Stauber
mstauber at blueonyx.it
Wed Jun 17 08:36:55 -05 2009
Hi Tony,
> I am trying RMail to send email by PHP and I get;
>
> Apache [apache at domain] on behalf of Sender [sender at domain]
>
> I have created the user but I still cannot figure out how to stop the 'on
> behalf of' being added by Sendmail.
There are like a dozen ways how a PHP script can send emails. Among them it
can use the PHP mail() function, it can use one of the various PEAR modules,
can create a socket with Sendmail or use the SMTP protocol to establish
communication with a smail server or it can launch a system call to fire up
the sendmail binary.
Your script is doing something rather unsophisticated. It's using the mail()
function and sends an email, *claiming* to be sender at domain.
For security reasons Sendmail then adds a warning, telling that Apache tried
to fake the sender address of the email.
The "easy" and unsecure way around that is to add "apache" to
/etc/mail/trusted-users, so that Sendmail *trusts* Apache and allows it to
fake the senders of email at hearts content.
The proper way however would be to use a more sophisticated email procedure in
your script.
For example you could use SMTP-Auth:
http://email.about.com/od/emailprogrammingtips/qt/et073006.htm
http://www.cyberciti.biz/tips/howto-php-send-email-via-smtp-
authentication.html
That way the script authenticates against Sendmail with a valid username and
password and uses SMTP to transmit the message.
--
With best regards
Michael Stauber
More information about the Blueonyx
mailing list