Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Setting up Postfix and Apache/PHP on an Ubuntu server. Mail's now going out ok with the proper domain name, but the local part display name is always "www-data" as I'm assuming Postfix uses the name of the user by default.

In the php.ini file, I was able to change the sendmail_path to sendmail_path = "/usr/sbin/sendmail -t -i -f support@example.com" but the email display name still appears as www-data . I tried specifying the display name a few different ways but that was ignored and the mail still went out as www-data.

What I'd like to be able to do is by default, have any mail with missing from, return-path, etc. headers go out as "Example Support" <support@example.com>, but I'm not sure if that's possible.

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

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.)

share|improve this answer
    
This works well, thank you. I usually set the headers properly when sending out through PHP mail(), etc. but wanted to set something as the default in case the headers were incorrect, etc. –  WuckaChucka Dec 6 '10 at 21:12
    
Note you can use BOTH the -f and -F options to set display name and address. For example: -F "Support System" -f "support@example.com" –  Liam Feb 21 '12 at 16:53
add comment

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

share|improve this answer
    
Does this also work for setting the return-path when the MUA is PHPmailer and PHPmailer is using mail()? –  Gaia Oct 28 '12 at 20:05
add comment

Add in your main.cf

smtp_generic_maps = hash:/etc/postfix/generic

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

www-data support@example.com

postmap /etc/postfix/generic and reload postfix. Your send name is now support@example.com

share|improve this answer
2  
This had no effect. –  WuckaChucka Dec 6 '10 at 21:07
    
do you reload postfix ? Maybe restart. Do you have errors in your logs ? –  Dom Dec 6 '10 at 21:09
    
Does this also work for setting the return-path when the MUA is PHPmailer and PHPmailer is using mail()? –  Gaia Oct 28 '12 at 20:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.