Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » Code language for emails


Code language for emails

Reply
  #1 (permalink)  
Old 04-20-06, 10:28 AM
gigafare gigafare is offline
Newbie Coder
 
Join Date: Oct 2005
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Code language for emails

I'm working in an editor whereas writing in HTML for PHP publication works perfect, i got a feature that sends whatever i type to email addresses. However: this doesn't work at all

> No pictures
> Background color completely different
> No <p style...
> No <font style...

What code do i write in for emails?
Reply With Quote
  #2 (permalink)  
Old 04-20-06, 01:27 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
To get HTML email to work, in addition to formatting the message body using HTML, the mail headers need to be correct and the receiving email client software needs to support HTML emails (some don't) and have the HTML support enabled (some people prefer to get plain text emails only and turn this off.)

If you don't mind using a PHP mailer class, the easiest way to accomplish this is to use something like the phpmailer class - http://phpmailer.sourceforge.net/ This also includes a way to send a plain text version to those who cannot view an HTML email or don't want an HTML email.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
  #3 (permalink)  
Old 04-20-06, 03:30 PM
gigafare gigafare is offline
Newbie Coder
 
Join Date: Oct 2005
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
The thing is i think it does work (HTML) but it's completely wrong in the inbox from hotmail for instance, supposed to read HTML and other email providers.

You think it's the header not sending enough?
It does look great in the FCKeditor...
Reply With Quote
  #4 (permalink)  
Old 04-20-06, 04:13 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
You think it's the header not sending enough?
Yes, for the email client to process an email as HTML it must include the proper headers, see the following -
PHP Code:

$headers  'MIME-Version: 1.0' "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n"
See Example 4 at this link - http://www.php.net/manual/en/function.mail.php
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???

Last edited by mab; 04-20-06 at 04:16 PM.
Reply With Quote
  #5 (permalink)  
Old 04-21-06, 03:06 AM
gigafare gigafare is offline
Newbie Coder
 
Join Date: Oct 2005
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Here's what it says in mine:

$contenttype = 'text/html';
$extra = "MIME-Version: 1.0\nContent-Type: $contenttype;charset=iso-8859-1\nX-Priority:3\nX-MSMail-Priority: Normal\nFrom: noreply@".$config['sitename']."\n";
Reply With Quote
  #6 (permalink)  
Old 04-21-06, 04:44 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
The only thing I can see is that the PHP manual states that "\r\n" is the proper seperator between the extra headers. You only have "\n". Try adding the \r to each \n.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
  #7 (permalink)  
Old 05-03-06, 05:52 PM
andrew_wazzup andrew_wazzup is offline
Newbie Coder
 
Join Date: May 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
It isnt just that your email client isnt set up to display html email (for safety reasons) and is so displaying it as just plain text?

Or am i miles off the point?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Explanation of Code... Please davidk19380 Perl 1 02-26-06 01:50 PM
Zip Code search range errors Merovingian PHP 2 02-09-06 03:33 PM
Select language zitwep PHP 3 01-01-06 12:48 PM
Have a look at my JSP code which is not giving me the desired output j.gohel Everything Java 1 04-07-05 03:55 AM
How to sale php code to customer without giving him code pradeep_soft PHP 4 03-12-04 12:10 PM


All times are GMT -5. The time now is 08:50 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.