1

I have PHP 5.5.9 on Ubuntu 14.04.3 LTS. I use sSMTP and Google's SMTP to send mails on PHP's mail() function. Something has changed, because now when I recieve the email from server, sender is www-data, even tho I have specified headers for email as shown below

$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: Site Webmaster <noreply@myserver.com> \r\n";
$headers .= "To: ".$email."\r\n";
$headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();

mail('', $subject, $message, $headers) or die(var_dump(error_get_last()));

It works otherwise, but as I sad, sender is shown as www-data


I'v tried to add lines to revaliases on sSMTP, and I have

FromLineOverride=YES

in ssmtp.conf, but it still doesn't work

Össi
  • 41
  • 1
  • 2
  • I don't think you're using SMTP. That looks like the typical PHP mail. – durbnpoisn Oct 16 '15 at 20:20
  • Try adding an alias www-data noreply@myserver.co – Lucky Chingi Oct 16 '15 at 20:23
  • Recommend changeing to Phpmailer. For full control –  Oct 16 '15 at 20:44
  • I'm skeptical that you're successfully using GMail for your SMTP server (unless theres a different Google SMTP service?) because GMail will [_always_ rewrite your email's `FROM:` header](http://stackoverflow.com/questions/1332510/how-to-change-from-address-when-using-gmail-smtp-server) to the user that authenticated with GMail. This is supposed to prevent spamming. – HPierce Oct 16 '15 at 21:02
  • So you suggest, that Gmail is the reason the From: address is not working? Since mail goes trough, but sender changes to www-data – Össi Oct 19 '15 at 10:57
  • Also, aliases won't work. "newaliases: Aliases are not used in sSMTP". And the PhpMailer won't fix the problem. I still need to use remote SMTP-server for the mail to be sent. – Össi Oct 19 '15 at 11:19

0 Answers0