0

I'm trying to understand what I'm missing here. I have following PHP script:

<?php

ini_set('sendmail_from','[email protected]');
mail('[email protected]',rand(),rand());

?>

... and even though I set sendmail_from to [email protected], I still get emails with from field which is: apache@localhost.

What am I doing wrong?

* UPDATE *

PHP version:

$ rpm -q php
php-5.3.3-27.el6_5.x86_64
$ 

@NathanC

echo(ini_get('sendmail_from')); returns [email protected] as it suppose too.

$ ll /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21 May  7  2013 /usr/sbin/sendmail -> /etc/alternatives/mta
$ ll /etc/alternatives/mta
lrwxrwxrwx. 1 root root 26 May  7  2013 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
$ 
9
  • This a webhost or your personal server? Hosts can disable ini_set() pretty easily so it wouldn't work.
    – Nathan C
    Jul 17, 2014 at 15:16
  • @NathanC I'm using my own environment, disabling of ini_set() has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. (I'm using 5.3.3).
    – alexus
    Jul 17, 2014 at 15:19
  • Check for safe_mode being on or anything being set in disable_functions. These don't actually exist in PHP >5.4, but your version wasn't mentioned.
    – Nathan C
    Jul 17, 2014 at 15:23
  • Also, as a test, put echo ini_get('sendmail_from'); before and after you do the set to see if it's actually working.
    – Nathan C
    Jul 17, 2014 at 15:24
  • @NathanC echo(); shows me right sendmail_from ([email protected]) as what was set in ini_set earlier, yet email still showing up as apache@localhost.
    – alexus
    Jul 17, 2014 at 15:26

0

You must log in to answer this question.

Browse other questions tagged .