I've configured exim开发者_高级运维 on my server as MTA to work with gmail. Here is a configuration:
gmail_login:
driver = plaintext
public_name = LOGIN
client_send = : myaccount1@gmail.com : mypassword
The configuration is OK and I'm able to send a mail using a php script:
$to = 'myaccount3@gmail.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: myaccount2@gmail.com' . "\r\n" .
'Reply-To: myaccount2@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (mail($to, $subject, $message, $headers)) {
echo 'mail() Success!' . "<br />\n";
}
else {
echo 'mail() Failure!' . "<br />\n";
}
However I've encountered an issue:
gmail shows myaccount1@gmail.com in the FROM field instead of the actual email specified in the FROM field in my script (myaccount2@gmail.com). The reply-to field is OK.
Please, help to solve the issue.
Gmail overwrites any FROM value you specify. Gmail overwrites it with the authenticated FROM value.
精彩评论