Answer the question
In order to leave comments, you need to log in
Virtualmin default mailbox setting for mail() in php?
The server is running LAMP and Virtualmin. How to set up a box from which mail will be sent by the mail () function in php on a virtual server. If there is such a thing in Virtualmin, then it is desirable how to do it using it, if not, then tell me in the direction of which configs or directions to dig.
Answer the question
In order to leave comments, you need to log in
I'm afraid there is no connection at all between the "box" for mail () and Virtualmin. When mail() is called, php stupidly calls /usr/sbin/sendmail and passes the headers and message to it. The most sendmail knows is the UID of the process that called it (so the address is @).
Another thing is that you can specify the return address and the From: field of the outgoing message using headers, and this is done very simply by calling mail() approximately like this:
Or you can also specify additional parameters for sendmail using the fifth parameter mail():
but this is not such a flexible solution for my taste.
In Google, there are tips to change the sendmail_from parameter in php.ini, but they are wrong - this parameter only works in Windows.
mail('Кому <[email protected]>', 'Тема', 'Сообщение', "From: От кого <[email protected]>\nReply-To: Кому ответить <[email protected]>");
mail('[email protected]', 'the subject', 'the message', null, '[email protected]');
As dmiceman wrote, when sending mail with a script, there is no sender, but you can specify the FROM field.
To do this, specify in the php.ini file:
sendmail_path = "/usr/sbin/sendmail -t -i -f [email protected]"
Replacing [email protected] with the desired address.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question