PHP function mail () 5th argument

Universal post script with PHPMailer when sending letters using mail() as the 5th argument to the function substitutes the string "-oi-f".
Popular framework CodeIgniter does the same thing, only without a flag "-oi".

But not sending a letter if the 5th parameter is the key "-f".

Do not want (and wrong) to change the framework code. It would be better to make the necessary changes in server configuration, I think. The problem is that I don't know what should be the settings (I hope the admins Valuehost will meet, if I will tell them what and where to fix).

Has anyone faced such a problem? Does anyone know the reasons why mail() might not work with key "-f"?

In advance thanks a lot :)
October 14th 19 at 12:06
6 answers
October 14th 19 at 12:08
as a former stand hoster familiar with the problem. We have a mailer was exim. The heart of the incident that mail server refuses to set the Sender field to any name, and only then, from whom you start the process (PHP). You can also include the resolution of such substitution, but personally I would bulk server hosting did not. This prohibition helps keep track of spammers and hacked clients. But on the same peg Itseh and often was turned off such a check.
Statesperson advantages You :) Finally the picture starts to clear! - faustino_Yost34 commented on October 14th 19 at 12:11
Now phpinfo() outputs the following:
sendmail_from moemory
sendmail_path /usr/sbin/sendmail -t-i-f 'moemoe'

Try to test the script to put the same address in all places, implying the sender (including a 5-m parameter). To no avail :(

PS support said that in my case they will not rule config, "because he shared". - faustino_Yost34 commented on October 14th 19 at 12:14
October 14th 19 at 12:10
Read here description 5 parameter (additional_parameters).
The essence — the fifth parameter is used to pass additional flags to the program used to send mail. For example, this parameter can be used to set the address of the envelope sender when using sendmail with the-f flag.
There is a separate indication. The user, under which runs the web server must be added to trusted (trusted) to the sendmail configuration to prevent adding the header "X-Warning", when the sender is specified using the-f flag. For sendmail users, this file — /etc/mail/trusted-users.
In the end, for details of the answer to your question is to read the documentation for the program that sends mail on the server.
Thanks, I already tried yesterday to dig deeper in the directory /etc/mail/, and trusted-users was not there :( I'll Try to ask tech support to share docks at upravlaushiy mail program. - faustino_Yost34 commented on October 14th 19 at 12:13
October 14th 19 at 12:12
With PHP 4.2.3, this parameter is forbidden in safe mode and mail() function will issue a warning message and return FALSE if you try to use it.
Maybe this is your case and using the safe mode
phpinfo says that safe_mode is Off, I checked it first thing, thanks for the advice. - faustino_Yost34 commented on October 14th 19 at 12:15
October 14th 19 at 12:14
Why not use the sendmail function is the same in CodeIgniter?
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';

Well, because I don't use CodeIgniter. I am doing a site on MODx. And I don't want to make changes to the engine itself, it kakbe not my rules :)
I want to indirectly help the host, forcing him to deal with the settings, because by doing so he will solve all similar future problems with the fans MODx, CI and PHPMailer. - faustino_Yost34 commented on October 14th 19 at 12:17
October 14th 19 at 12:16
you need to wean your CMS to insert the 5th argument.
In the dock it is written that there is a possibility in the config config/email.php (there is no default) specify settings for sending mail. Including you can make sending via an SMTP connection instead of the local mail server.
Try to go that route.
Most likely will have to manually edit the code of the library PHPMailer. SMTP tried, does not work and support said not to use SMTP. I think the SIM can question close :( - faustino_Yost34 commented on October 14th 19 at 12:19
well, I can't help it :) Too many "impossible" from your hosting company :)
I opened the access to SMTP, there is the ability to control the flow of spam. - faustino_Yost34 commented on October 14th 19 at 12:22
October 14th 19 at 12:18
Perhaps it is worth considering whether you need General
I'm certainly not trying to dissuade, but when I did one proaches in which the customer is attended to by domain and hosting (Yes, valuehost) — opplevelse at work. Starting from the fact that they are not tied to the domain account (how is that even possible?), he then tied it crooked (enter the address of the site and... get on some German Parking-page), ending with endless "Yes, it features our servers configs, no change, no one will, our freeBSD the freeBSD and BSD all free", although on 3 other hosts are all perfectly working and running :(
I am overall pleased with the hosting and support. Usually any problem can be solved quickly and professionally (can be of importance and some of my knowledge in most issues :) ). In this situation, the change of hosting — not the escape that I had to choose. I still made a change in PHPMailer :( - faustino_Yost34 commented on October 14th 19 at 12:21

Find more questions by tags CodeIgniterE-mailPHPPHPMailer