We have a webserver that hosts 2 domains.
PHP version: 5.3.3-7+squeeze14
Apache info:
Server version: Apache/2.2.16 (Debian)
Server built: Nov 30 2012 08:33:45
These are configured in these directories:
/etc/apache2/sites-available
/etc/apache2/sites-enabled
/etc/apache2/ports.conf
Everything responds correctly in the web browser, except we're having problems with sending email.
I have exim4 set up for email but I'm not sure if I have it configured correctly. Before I set up the 2nd domain (
www.domain2.us), email was working fine from the original domain (
www.domain1.com). After I set up domain2.us, email stopped working for domain1.com (& didn't work for domain2.us).
I tried
dpkg-reconfigure exim4-config several times and eventually got domain2.us and domain1.com to be able to send email from a simple test script that looks like this:
domain1.com:
PHP Code:
<?php
$headers = 'From: [B]webmaster@domain1.com[/B]' . "\r\n" .
'Reply-To: [B]webmaster@domain1.com[/B]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
// The message
$message = "[B]domain1.com[/B]\nLine 1\r\nLine 2\r\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");
// Send
$suc = mail('myemail@hotmail.com', 'My Subject', $message);
echo '[' . $suc . ']';
?>
domain2.us:
PHP Code:
<?php
$headers = 'From: [B]webmaster@domain2.us[/B]' . "\r\n" .
'Reply-To: [B]webmaster@domain2.us[/B]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
// The message
$message = "[B]domain2.us[/B]\nLine 1\r\nLine 2\r\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");
// Send
$suc = mail('myemail@hotmail.com', 'My Subject', $message);
echo '[' . $suc . ']';
?>
However, when the emails come in the sender for domain1.com shows up as:
webmaster@domain1
emails from domain2.us show up as:
www-data@domain1
How can I get the ones from domain2.us too show up as being from webmaster@domain2 instead of www-data@domain1?
Thanks!