Solved

PHP EMail - Headers not working (Reply-To etc.)

Posted on 2009-04-14
3
916 Views
Last Modified: 2013-12-17
Can anybody tell me why this does not work ...

      $headers =      'From: ' . $row_webdata['billing_email_address'] . "\r\n" .
                        'reply-to: ' . $row_webdata['contact_email_address'] . "\r\n" .
                        'bcc: ' . $row_webdata['copy_invoices']. "\r\n" .
                        'cc: ' . $row_webdata['info']. "\r\n" .
                         'X-Mailer: PHP/' . phpversion();

The e-mail goes to the 'to' address quite happily but not to the 'cc' address (although that appears on the e-mail headers). The 'reply-to & 'bcc' do not seem to make any impact on this e-mail mstatement they neither appear on the email header nor result in an email? I have played around with the case, i.e. Reply-To' etc. but none of it seems to make any difference.

Thanks.
Patrick.
0
Comment
Question by:me_patrick
[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
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
Chris_Gralike earned 500 total points
ID: 24137074
There are issues with older php versions running on Windows.  They use their own implementation to talk to the mailserver. As far as i know these are working fine in later versions. Also make sure the header is constructed correctly.

$header = "From:".$row_webdata[billing_email_address]."\r\n";
$header .= "reply-to:". $row_webdata['contact_email_address']."\r\n";
$header .= "bcc:".$row_webdata['copy_invoices']."\r\n";  < contained a typo.
$header .= "cc:".$row_webdata['info']."\r\n"; <contained a typo.
$header .= "X-Mailer:PHP". phpversion();

Im not sure how the values of the vars look, but make sure they also have the correct syntax :)
Please try the code above and let me know.

Rgrds,

0
 

Author Closing Comment

by:me_patrick
ID: 31575387
Hi Chris,

Thanks a lot for taking the time to respond and sorry for taking so long to get back to but I got distracted on something else ... anyway I'm back and blimey ... you've only gone and done it!

I can't however see what you've done ... I'm looking and looking and I can't see the difference between what I had and what you suggested (I can't even see the typo's that you refer to)??

Anyway I re-jigged my headers into several statements rather than one and it worked ...  oh dear ... I've just looked again and I'm afraid it was all just a school boy error on my part ... my select statement was only pulling back certain web address fields and not all, so my cc and reply to addresses were not available .... D'oh!

Anyway - great all sorted and thanks again.
P.
0
 
LVL 10

Expert Comment

by:Chris_Gralike
ID: 24249715
Sorry, I did not notice at first that it was supposed to be one long line of text. Noticed it after I read the line again, and thought for readability ill just leave it like this.

Happy you sorted the problem though.

Rgrds,

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is this? I've never seen this... 2 29
Adding additional variables to key => value association 17 39
PHP Curl Problem 10 41
How do i use the await event in php echo 5 19
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
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 …

733 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