PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 May 11th, 2008, 01:42 PM
specto specto is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 1 specto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 21 sec
Reputation Power: 0
Problem with sending HTML emails

I created some system for sending mails to members about some events. That is HTML mail and have also simple Form for subscribing to events.

Everything is great but some users dont get HTML mail. They get just source code. This users are using Outlook Express and Windows XP.

I would porobably fix that but problem is that i see everything OK, and i dont know what to fix coz i cant see effects.

Function for sending mail is:

PHP Code:
function send_mail($from$email$subject$text){
    
// MAIL 
                                
    
$header="";
    
$message="";
    
$boundary='--' md5uniqid("myboundary") );
    
$priorities = array( '1 (Highest)''2 (High)''3 (Normal)''4 (Low)''5 (Lowest)' );
    
$priority=$priorities[3];
    
$charset="UTF-8";
    
$ctencoding="8bit";
    
$subject=$subject;
    
    
$body=$text;                                                        
    
$to=$email;
    
    
$cc=$to;
    
$bcc=$to;
    
$sepchr(13) . chr(10);
    
$ctype=$type["bilinmiyor"];                            
    
    
$message .="This is a multi-part message in MIME format.\n--$boundary\n";
    
$message .= "Content-Type: text/html; charset=$charset\n";
    
$message .= "Content-Transfer-Encoding: $ctencoding\n\n" $body ."\n";    
    
    
$header.="From: $from\nX-Priority: $priority\nCC: $cc\n";
    
$header.="Mime-Version: 1.0\nContent-Type: multipart/mixed;\n boundary=\"$boundary\"\n"
    
$header.="Content-Transfer-Encoding: $ctencoding\nX-Mailer: Php/libMailv1.3\n";
    
    
mail($to,$subject,$message."\n",$header);



I hope you understand me. I really need help and be very thankfull if we could fix that.

Reply With Quote
  #2  
Old May 11th, 2008, 09:17 PM
Hammer65's Avatar
Hammer65 Hammer65 is offline
Web Developer/Musician
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Nov 2004
Location: Lincoln Nebraska
Posts: 2,083 Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level)Hammer65 User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 10 h 3 m 15 sec
Reputation Power: 590
Send a message via AIM to Hammer65
You really should use a pre-written mail class for this sort of thing. All the popular mail classes have features that allow you to send messages in both HTML and plain text to compensate for this. There are just too many things about using the mail function for automated mail to trouble shoot unless you really want to take the time to learn all of them. If that is your goal, then take a look at the source code for mail classes like PHPMailer, Swiftmailer, PEAR::mail or Zend mail. If you just want to get it to work, then use one of those classes instead of trying to do it yourself.
__________________
"Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony! Well, but you can't expect to wield supreme executive power just 'cause some watery tart threw a sword at you! I mean, if I went 'round saying I was an emperor just because some moistened bint had lobbed a scimitar at me, they'd put me away!"

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Problem with sending HTML emails


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT