When I send email using Zend Mail using the following code:
$to = array("[email protected]","[email protected]","[email protected]");
$msg = file_get_contents("email.html");
$mail = new Zend_Mail ( "UTF-8" );
$mail->setMessageId ( "MyMsg__" . md5 ( microtime () ) );
$mail->addHeader ( "Content-Type", "text/html; charset=UTF-8" );
$mail->setBodyHtml ( $msg );
$mail->setSubject ( "News Letter Test" );
$mail->setReplyTo('[email protected]', 'Some Name');
$mail->addHeader('MIME-Version', '1.0');
$mail->addHeader('Content-Transfer-Encoding', '8bit');
$mail->addHeader('X-Mailer:', 'PHP/'.phpversion());
$mail->setFrom ('[email protected]', 'Some Name');
foreach($to as $ml){
$mail->addTo ( $ml );
}
$mail->send ( $transport );
I get this in gmail:
[email protected] via u4552323.onlinehome-server.com
How do I remove this part: via u4552323.onlinehome-server.com
Notice I have full root access and this is a dedicated server, if the problem is in send_mail config, or hosts, how do I change this part u4552323.onlinehome-server.com ?
Google displays the 'via' information in Gmail in when messages are sent through another domain. In your case, the message is coming from an address in the mydomain.com
domain, but the mail server is in the onlinehome-server.com
domain.
You can avoid this by sending mail through the SMTP server for the mydomain.com
domain (assuming your hosting provider doesn't block such traffic). If can control the DNS and mail server configuration for the onlinehome-server.com
server, you can also configure SPF and DKIM, as explained in Google's documentation (but this may not be an option depending on your hosting environment).