简体   繁体   中英

What e-mail header is needed for a message to be displayed as 'via:'?

I have noticed that some mails come with the from address like :

Adam Mannet via www.findyourfriend.com.

What headers do I need to pass to the native PHP mail() function to accomplish this when sending e-mail?

I think the via tag is added by the mail server when somebody uses an external (from his domain) smtp server. Per example, my email is iceduck@iceduck.net but I send email via Gmail's smtp, you will see From iceduck@iceduck.net via Gmail.com. If you want to make the via appear then you'll have to send your mail through the smtp server you want to appear in the via. You can check out this link : http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm

I don't think the solution is in the header.

Best

You should check PHP mail documentation. There is a description how to modify 'From' header. You should use additional_headers to change that header information and include 'friendly name' beside your e-mail address.

<?php
// The message
$message = "Message content";
$headers = 'From: User Name <user@example.com>';

// Send
mail('test@example.com', 'My Subject', $message, $headers);
?>

This should make your from address look like: 'User Name via www.example.com'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM