Solved

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

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

Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

Join & Write a Comment

Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
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…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

757 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

18 Experts available now in Live!

Get 1:1 Help Now