开发者

PHP sendmail_path Flags -- Not working correctly?

开发者 https://www.devze.com 2023-01-24 11:49 出处:网络
I recently switched hosts and am having an issue with the mail() function. On my previous host, I could define the from address through the header by doing this:

I recently switched hosts and am having an issue with the mail() function.

On my previous host, I could define the from address through the header by doing this:

mail("test@email.com","subject","message","From: fake@email.com");

On th开发者_Python百科e new host however, it ignores the From header. Instead it sends from a default email account something@something.myhost.com.

In php.ini, the sendmail_path is set as follow: sendmail_path = /usr/sbin/sendmail -t -i

As far as I can tell from researching, this should allow me to set the from address in the header.

Any ideas?


You could try:

ini_set("sendmail_from", "fake@email.com");

The set_ini dynamically sets the configuration option, in this case the sendmail_from

"Sets the value of the given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending."

is the definition for ini_set found at :PHP.NET

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号