• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Changing "anonymous@mydomain" default PHP Sender

jnarvaez

Basic Pleskian
Hi,

I have a box with several domains and every user that send a mail from php without specifying "from address" the mail is sended from "anonymous@mydomain", I would like to change this to something like "not@specified".

I have been looking into php.ini and sendmail.mc and .cf and nothing was found.

Any help would be appreciated.
 
Try this, if this doesnt work for you - google is your friend :)

Found this here

Here's how the section might look on a typical Windows server, or on a Linux server without sendmail:

[mail function]
; Setup for Windows systems
SMTP = smtp.my.isp.net
sendmail_from = [email protected]

And here's how it might look on a Linux server with sendmail:

[mail function]
; Setup for Linux systems
sendmail_path = /usr/sbin/sendmail -t
sendmail_from = [email protected]

With those settings in place, restart your Web server and you're ready to go!
 
Hi, thanks for your answer.

Google is my best right now :D
but I can't find any solution

My php.ini looks like this now:

[mail function]
; Setup for Linux systems
sendmail_path = /usr/sbin/sendmail -t
sendmail_from = [email protected]

and after restarting httpd i keep recieveng php mails from anonymous@...

any idea?
 
Yeah it was a long shot, typically that php option is only available for windows php installs since most of that stuff on linux is done by sendmail.

Sorry I cant be more help then that right now - I'll keep thinking about it, I've done it before a couple years ago for a client but I cant remember for the life of me what i did....
 
If you want different addresses for each domain, basically you need to create a vhost.conf for each domain in /home/httpd/vhosts/domain.com/conf:

<Directory /home/httpd/vhosts/domain.com/httpdocs>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
</Directory>

then use websrvmng -u -a (check the syntax -- this may not be correct)

Or you can just try adding the -f [email protected] to the sendmail path in php.ini if you want the same address for all domains on the server.

Note that your path may be /var/www/vhosts instead of /home/httpd/vhosts

Faris.
 
Thanks Faris,

If Im not mistaken they can also do this in an htaccess file right?
 
I don't honestly know if it can be done via an .htaccess file - I've never tried it.

Faris.
 
According to php.net you can't.. :(
php_admin_value name value

Sets the value of the specified directive. This can not be used in .htaccess files. Any directive type set with php_admin_value can not be overridden by .htaccess. To clear a previously set value use none as the value.

I did find this: http://forum.swsoft.com/showthread.php?s=&threadid=45074

But changing code on each site isn't a great option either.
 
Back
Top