Solved

Server name is being added in php mail header

Posted on 2007-11-21
3
838 Views
Last Modified: 2008-02-01
Hi,
    I am using php script for sending mail and i have code like:

                     $mailHeaders  = "MIME-Version: 1.0\n";
               $mailHeaders .= 'reply-to: <my-company-name>' . "\r\n";
                  $mailHeaders .= 'To: name1Tyagi <xx@exxx.com>, name2 <xxx@xxxx.in>' . "\r\n";
                  $mailHeaders .= 'Cc: cccc@ccc.com' . "\r\n";
                  $mailHeaders="From: <my-company-name>\nContent-Type: text/html; charset=iso-8859-1";
                 mail($mail_to,$mail_subject,$msg,$mailHeaders);

 Mail is going fine but i am geeting some extra header in mail like:

        reply-to      <my-company-name>@<server-name>,
                           <my-company-name>@<server-name>,
                          <my-company-name>@<server-name>       
      to            xxxx@xxxx.in       
      date            20 Nov 2007 12:05:16 -0600       
      subject            <subject>       
      mailed-by            <server-name>

  I don,t want the <server-name> in my mail header ...i don't know why it is being added. i m not mentioned it in my code
  note: <server-name> is the linux serve name or host provider ..yess our linux server hosted by this name(server-name)
   please reply ASAP
Thankyou
0
Comment
Question by:npglobal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 500 total points
ID: 20326620
try this

$mailHeaders  = "MIME-Version: 1.0\n";
               $mailHeaders .= 'reply-to: my-company-name <companyemail@companyurl.com>' . "\r\n";
                  $mailHeaders .= 'To: name1Tyagi <xx@exxx.com>, name2 <xxx@xxxx.in>' . "\r\n";
                  $mailHeaders .= 'Cc: cccc@ccc.com' . "\r\n";
                  $mailHeaders="From: my-company-name <companyemail@companyurl.com>\nContent-Type: text/html; charset=iso-8859-1";
                 mail($mail_to,$mail_subject,$msg,$mailHeaders);
0
 
LVL 4

Expert Comment

by:simonkin
ID: 20327497
Hi,

Try calling your mail function like this...
<?php
 
// Where email@domain.com is the email address you are sending from
mail($mail_to,$mail_subject,$msg,$mailHeaders,"-femail@domain.com");
 
?>

Open in new window

0
 
LVL 17

Expert Comment

by:nplib
ID: 20328513
Out of curiosity, why do you not want your server name in the header?

That's how the receiving email server can validate the emails origin, so that it doesn't think it's spam.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question