Answer the question
In order to leave comments, you need to log in
Configuring postfix to send emails?
Hello!)
I want to send emails to users from my server. I set up Yandex.Mail for my domain, and installed and configured postfix on the server following this instruction . Letters are sent, everything works, but the From header indicates: www-data <[email protected]>
I want it to be: Support <[email protected]>
I found an answer on SO that partially solves my problem. In main.cf I added a line: smtp_generic_maps = hash:/etc/postfix/generic
And in the /etc/postfix/generic file I wrote: www-data [email protected]
Now I receive letters with the heading "From www-data [email protected] ". Tried to register aliases, but it doesn't work either.
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
www-data: Support
$to = "[email protected]";
$subject = "Ваша учетная запись активирована";
$message = "Ваши данные: login и password";
$headers = "From: Support <[email protected]>\r\nContent-type: text/html; charset=windows-1251 \r\n";
mail ($to, $subject, $message, $headers);
Answer the question
In order to leave comments, you need to log in
The problem is not with Postfix.
Your PHP sends mail from the user under which it is running.
Simple crutch - change sendmail_path
In my php-fpm:
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
But it's better to work from PHP directly with Yandex server
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question