B
B
burzilov2010-09-17 01:55:19
CodeIgniter
burzilov, 2010-09-17 01:55:19

PHP mail() function, 5th argument?

The PHPMailer universal mail script , when sending a letter using the mail() function, substitutes the string " -oi -f [email protected] " as the 5th function argument .
The popular CodeIgniter framework does the same, but without the " -oi " flag.
But valuehost.ru does not send an email if the 5th parameter contains the " -f " key.
I don’t want (and it’s wrong) to change the framework code. It would be better to make the necessary changes to the server settings, I think. The problem is that I don’t know what these settings should be (I hope the admins of the valyuhost will meet halfway if I tell them what to fix and where).
Has anyone encountered such a problem? Does anyone know why mail() might refuse to work with the " -f " option?
Thank you very much in advance :)

Answer the question

In order to leave comments, you need to log in

6 answer(s)
C
charon, 2010-09-17
@charon

I'm familiar with the problem as a former hoster support. Our mailer was exim. The essence of the incident is that the mail server forbids substituting any name in the Sender field, but only the one from whom the process is started (PHP). You can also enable the permission of such a substitution, but personally I would not do this on a mass hosting server. Such a ban helps track spammers and hacked clients. But on VPSs and collocation, such a check was often turned off.

A
Andrey Yakushev, 2010-09-17
@kpower

We read here the description of the 5th parameter ( additional_parameters ).
Essence - the fifth parameter is used to pass additional flags to the program used to send mail. For example, this option can be used to set the envelope sender address when using sendmail with the -f flag.
There is also a separate note. The user under which the web server is running must be added to "trusted" in the sendmail configuration to prevent the "X-Warning" header from being added when the sender is specified with the -f flag. For sendmail users, this file is /etc/mail/trusted-users.
As a result, for the details of the answer to your question, it is worth reading the documentation for the program that sends mail on the server.

E
evg_vl, 2010-09-17
@evg_vl

As of PHP 4.2.3 this option is disabled in secure mode and the mail() function will issue a warning message and return FALSE if you try to use it.
Perhaps this is your case and valuehost.ru uses safe mode

A
Alexey Ashurok, 2010-09-17
@AotD

Why not use the sendmail function of the same CodeIgniter?

$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';

$this->email->initialize($config);
...

C
charon, 2010-09-17
@charon

you need to somehow wean your CMS to insert the 5th argument.
The dock codeigniter.com/user_guide/libraries/email.html says that it is possible in the config/email.php config (does not exist by default) to set the settings for sending mail. Incl. it is possible to send via SMTP connection instead of local mail server.
Try to go this route.

A
Alexey Ashurok, 2010-09-17
@AotD

Or maybe you should think about whether you need valuehost.ru at all?
Of course, I don’t dissuade, but when I made one project in which the customer had already taken care of the domain and hosting (yes, valuehost) - I spat at work. Starting from the fact that they didn’t link the domain to the account (how is this even possible?), then they tied it crookedly (we enter the site address and ... we get to some German parking page), ending with the endless “yes, these are the features of our server configs, no, no one will change, our freeBSD is the most freeBSD of all free and BSD”, although on 3 other hostings everything worked fine and ran :(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question