Current location: Hot Scripts Forums » Programming Languages » PHP » PHP mail function and Gmail


PHP mail function and Gmail

Reply
  #1 (permalink)  
Old 12-28-05, 02:42 PM
strings6 strings6 is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Fort Myers, FL
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
PHP mail function and Gmail

Hello,

I have a function that sends an HTML email with the php mail function. It works great when I check my email with Outlook Express. But when I check my email with Gmail, it does not work. With Gmail you just see the HTML code. Does anyone know what might be going on here? Thanks.
Reply With Quote
  #2 (permalink)  
Old 12-28-05, 04:18 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
That's because gmail disables HTML inside emails by default. To my knowledge, there is no easy way to enable HTML inside emails in the current beta version of gmail, unless you do POP3 download and view it in Outlook on your PC.
__________________
Reply With Quote
  #3 (permalink)  
Old 12-28-05, 04:43 PM
strings6 strings6 is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Fort Myers, FL
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
I have gotten html emails from gmail before. They work fine. Mine is the only one that is misbehaving...
Reply With Quote
  #4 (permalink)  
Old 12-28-05, 04:51 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
And if you ad something like this ?

PHP Code:

$headers "Content-type: text/html;charset=ISO-8859-9"
Reply With Quote
  #5 (permalink)  
Old 12-28-05, 04:53 PM
strings6 strings6 is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Fort Myers, FL
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Yeah, I have something like that
Reply With Quote
  #6 (permalink)  
Old 12-28-05, 10:01 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Hmm.... that's strange. Because for some reason my HTML emails don't get through on my gmail account.
__________________
Reply With Quote
  #7 (permalink)  
Old 12-28-05, 10:31 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:
Originally Posted by nico_swd
And if you ad something like this ?

PHP Code:

$headers "Content-type: text/html;charset=ISO-8859-9"
Are the opening and closing HTML tags present in the message body. One could imagine that one email client follows the rules while another ignores them (especially given MS programmer's past record.)
Reply With Quote
  #8 (permalink)  
Old 12-29-05, 07:47 AM
strings6 strings6 is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Fort Myers, FL
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Yup, all tags are opened and closed properly, including html, head, title and body, as well as all table, tr and td tags.
Reply With Quote
  #9 (permalink)  
Old 12-29-05, 07:58 AM
strings6 strings6 is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Fort Myers, FL
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
OK, here is something VERY strange that I cannot explain:

Not only is my HTML code showing up as the message body (rather than what the HTML code should do), but one of the lines from my header shows up at the top too:

Content-type: text/html; charset=UTF-8

This line is appearing before my initial html tag. And what is even more baffling, is the following. I tried making some changes to different parts in my code, like in the style tags and some other places. I saved my changes and re-sent my HTML email. Everything still worked fine in OE and Hotmail (except that Hotmail ticks me off because it is adopting their link colors instead of mine.... now that's a side issue that I also need help on). But when I go to Gmail it's still broken, and here is the really strange thing: The lines of code that I had JUST changed, were ALSO showing at the top of the message body, right under the Content-type line!

Baffled, I tested this again. I made some insignificant changes, like changing colors and such. Saved, resent email, checked Gmail. There it was again! The lines I had JUST changed were appearing at the top of my message body, BEFORE the initial html tag.

What in the world is going on with Gmail? And why is this only happening with MY email. My buddy sends me his HTML emails all the time, using the same content-type, and his works fine.
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


All times are GMT -5. The time now is 06:24 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.