Change default from address from Postfix from www-data to something else

Solution 1:

Add in your main.cf

smtp_generic_maps = hash:/etc/postfix/generic

And create a file named /etc/postfix/generic with :

www-data [email protected]

run postmap /etc/postfix/generic to compile and reload postfix. Your send name is now [email protected]

Solution 2:

As I understand the question, you're trying to set the full name of the sender, not the address (or, in addition to the address). In general, Postfix doesn't care what that is, and you set it when your MUA (in this case, some php script) generates the message headers. I'm not familiar with coding in php, but it looks like this is explained in the documentation for the PHP mail() function.

But if you're calling out to postfix's sendmail binary to send the message, you can use -F "Support System" to do what you want. Maybe this will have to be in the mail.force_extra_parameters setting — I'm not so clear on how php works here. (Mostly, that's the wrong thing to do anyways.)


Solution 3:

You should do one last thing to complete process which is @Dom has forgetten. Run the following command :

$ postmap /etc/postfix/generic

This command will be create generic.db file inside the /postfix directory.

If you don't do this, you can face of the following error output :

fatal: open database /etc/postfix/generic.db: No such file or directory