Helpful Information
Home
Categories
Contact us
Category: Mail Server Help
Sendmail error from php mail() function
I have set up a php mail script for a website which is not returning any error messages - code below:
$myname = "Alex";
$myemail = "alex@myemail.com";
$contactname = $username;
$contactemail = $_POST[email];
$subject = "my subject";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$myname."\" <".$myemail.">\n";
$message = "my message";
mail("\"".$contactname."\" <".$contactemail.">", $subject, $message, $headers);
This seems to be working fine. Only my mail log is returning the following error:
Oct 23 15:08:09 xxxx sendmail[6837]: h9NE89p06834: SYSERR(httpd): openmailer: insufficient privileges to change uid: Operation not permitted
Have not got a clue on this one - any ideas appreciated....
After hours of trawling (and a few beers) I found the solution:
For future reference -
This is a problem caused by subprocesses being run as the recipient ID who wont have the same permissions as root. The fix:
Modify sendmail.cf
Changes to /etc/sendmail.cf
Add the o flag and remove the S flag in the Mlocal, F= section (last lines of the file).
Before
Mlocal, P=/usr/sbin/scanmails, F=lsDFMAw5:/|@qS Pfhn9, S=10/30,
R=20/40,
T=DNS/RFC822/X-Unix,
A=scanmails -Y -a $h -d $u
After
Mlocal, P=/usr/sbin/scanmails, F=olsDFMAw5:/|@qPfhn9, S=10/30,
R=20/40
T=DNS/RFC822/X-Unix,
A=scanmails -Y -a $h -d $u
Thanks to http://www.ahinc.com/linux101/email.htm for that little beauty
privacy (GDPR)