PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 6th, 2012, 07:55 AM
hudbarnett hudbarnett is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Location: Edinburgh
Posts: 19 hudbarnett User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 19 m
Reputation Power: 0
Email Form sending the emailer a copy

Hi there

I have managed to get so far with my email form and it send to both the admin and also the email address entered for the sender.

But, the admin email is received in HTML and looks fine but when the sender receives the email its all HTML code and is unreadable.

Can someone please help me as i don't understand why this is happening.

Thanks in advance

Code:
<?php

$senderName   = $_POST['userName'];
$senderEmail     = $_POST['userEmail'];
$senderSubject   = $_POST['userSubject'];
$senderMessage = $_POST['userMsg'];

$senderName   = stripslashes($senderName);
$senderEmail     = stripslashes($senderEmail);
$senderMessage   = stripslashes($senderMessage);

      $to  = 'email address goes here' . ', ';
	  $to .= $senderEmail;
	  
    $from = "$senderEmail ";
    $subject = "$senderSubject";
    $message = <<<EOF
<html>
  <body bgcolor="#FFFFFF">
<b>Name</b> : $senderName<br /><br />
<b>Email</b> : <a href="mailto:$senderEmail">$senderEmail</a><br /><br />
<b>Subject</b> : $senderSubject<br /><br />
<b>Message</b> : $senderMessage<br />
  </body>
</html>
EOF;
   
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";
    $to = "$to";

    mail($to, $subject, $message, $headers, $senderEmail);
    
exit();
?>


thanks

Hudbarnett

Reply With Quote
  #2  
Old December 6th, 2012, 08:10 AM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,867 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 5 Days 9 h 6 m 6 sec
Reputation Power: 581
Please use [ PHP ] tags rather than [ CODE ] tags for your PHP. See the sticky at the top of this forum.

The reason has nothing to do with your PHP per se. The reader being used either is not capable of rendering HTML or has HTML turned off. This is a real world situation thus it requires you to modify your email to accommodate it.

You need to generate a multi-part email that can be rendered either with an HTML capable reader or a plain text reader. This should help.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old December 6th, 2012, 08:34 AM
hudbarnett hudbarnett is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Location: Edinburgh
Posts: 19 hudbarnett User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 19 m
Reputation Power: 0
Quote:
Originally Posted by gw1500se
Please use [ PHP ] tags rather than [ CODE ] tags for your PHP. See the sticky at the top of this forum.

The reason has nothing to do with your PHP per se. The reader being used either is not capable of rendering HTML or has HTML turned off. This is a real world situation thus it requires you to modify your email to accommodate it.

You need to generate a multi-part email that can be rendered either with an HTML capable reader or a plain text reader. This should help.


Thank you for getting back to me, i'll check out the link.

Thanks

Hudbarnett

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Email Form sending the emailer a copy

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap