[BlueOnyx:17740] Re: error in new phpsendmail

Tjerk Hacquebord lists at hqmatics.nl
Tue Jun 2 00:52:06 -05 2015


After seeing these messages I tried to send mail from a php script and it
does not get delivered.
PHP calls the sendmail wrapper script but after that nothing happens.

Jun  2 07:05:49 ve102 logger: sendmail-wrapper-php: site=xxx, client=xxx,
script=/home/.sites/120/site53/web/index.php, uid=, user=xyz

If I change the php setting to directory use sendmail it works again.
What could be wrong?

This is a 5106 server with latest updates.



Kind regard,
Tjerk


-----Oorspronkelijk bericht-----
Van: blueonyx-bounces at mail.blueonyx.it
[mailto:blueonyx-bounces at mail.blueonyx.it] Namens Michael Stauber
Verzonden: donderdag 28 mei 2015 20:28
Aan: BlueOnyx General Mailing List
Onderwerp: [BlueOnyx:17717] Re: error in new phpsendmail

Hi Wisja.net,


> This update also made it possible again for me to use the -f swith 
> within php.ini. Atleast my users can use mailscripts again, so both of 
> you thank you (big time!) for finding and solving my problem also.

Very well. Glad to hear it's working again.

> Michael, you wrote earlier that using the -f switch in php.ini is not 
> the correct way to do it.
> You pointed out that the option should be used within the script. Do 
> you mean the scripts of my customers or the phpmailer wrapper?

This totally depends on how you are emailing from a script. And if that
script is in Perl or PHP. For example: A lot of (old) Perl scripts just do
something like this:

system("/usr/sbin/sendmail recipient at mail.com < /tmp/my_email.txt");

In that case you'd throw the correct Sendmail switches in there. There are
even some (stupid) PHP scripts which use similar ways of Sending emails.
Even though both Perl and PHP have modules and functions that easily deal
with Sending emails in much better ways.

One of the easiest ways in PHP is this:

mail($recipient_email, "$subject", $body, "From:" . $sender_email);

See: http://php.net/manual/en/function.mail.php

And if you use suPHP (or on 5209R either mod_ruid2 or PHP-FPM) and have a
siteAdmin configured as "Web Server Owner", then the siteAdmin's email
address will be set as sender if your script has "forgotten" to set the
sender correctly.

Hence there is no need to set the sender manually in php.ini.

In fact: Why would you need to *fix* the server config to *repair* a problem
that was caused by improper coding in a mailing script? :o)

The mailer *should* set the sender address correctly by itself. If it
doesn't do that, then the PHP script is the problem. Not the PHP
configuration.

> When installing Wordpress I always have to change the 
> /includes/class-phpmailer.php to add a public sender and e-mail adres.

Yeah, that's one way to do it. Sadly the "stock" Wordpress doesn't let you
configure that in the backend and therefore this configuration gets
overwritten during each Wordpress update, too.

If I'm not mistaken, then this Wordpress Plugin seems to solve this:

https://wordpress.org/plugins/wp-email/screenshots/

--
With best regards

Michael Stauber
_______________________________________________
Blueonyx mailing list
Blueonyx at mail.blueonyx.it
http://mail.blueonyx.it/mailman/listinfo/blueonyx




More information about the Blueonyx mailing list