[BlueOnyx:17717] Re: error in new phpsendmail

Michael Stauber mstauber at blueonyx.it
Thu May 28 13:27:56 -05 2015


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



More information about the Blueonyx mailing list