Solved

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

Posted on 2009-04-14
3
913 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
  • 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

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Question has a verified solution.

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

Suggested Solutions

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
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 a Contact 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 Recipients >> Contact ta…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …

864 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now