TurnKey Linux Virtual Appliance Library

How to configure the system so that mail is sent from a legal email address

Swedie's picture

How can I change the header info in emails sent via PHP?

Currently in the log i get a lot of:

Apr 15 10:39:08 lamp postfix/smtp[3274]: 821843F6007: host mail.comhem.basefarm.net[] said: 451 Invalid sender <www-data@lamp> (in reply to RCPT TO command)

As you can see it denies the sender www-data@lamp ... but WHERE do I change this setting to something more appropriate?

Liraz Siri's picture

You need to configure Postfix

PHP manual on configuration mail settings: http://php.net/manual/en/mail.configuration.php

I'm going to assume PHP is configured to send mail via a locally installed mail server (e.g., postfix). You'll want to configure it so that instead of www-data@lamp, you're sending out mail as username@hostname.com.

If you're using postfix you can do that by setting up the myhostname parameter and to map www-data to a different username you'll want to setup a canonical map.

Configuring postfix will probably be a bit easier for you if you install the webmin-postfix module.

Hope this helps!

Swedie's picture

I did install postfix, and

I did install postfix, and that apparently made the emails stop working. I re-installed sendmail and it now works again since I could google myself towards finding the right configs. So postfix is a replacement to sendmail? But what should I type in php.ini for value to sendmail_path ?

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)