This is a discussion on Problems with mail() within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Im having a formatting issue with mail(). My simple script looks like: $key = blah@blah.com; $subject = "My membership&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Im having a formatting issue with mail().
My simple script looks like: $key = blah@blah.com; $subject = "My membership"; $message_to_send = "<strong>Hello".$key."</strong>"; mail($key, $subject, $message_to_send, "From: blah@blah.com"); When it comes to my email client it appears as: <strong>Hello blah@blah.com</strong> Instead of: Hello blah@blah.com I have also tried adding <html> and <body> tags but that doesn't seem to do anything. I get other HMTL messages from amazon and such but it would appear that one generated from mail() is sending only raw text. How do I get it to format HTML based message? |
|
|||
|
"Ryan Ramsey" <ryanramsey@yahoo.com> schreef in bericht news:bhZOa.875$5o5.577540@news1.news.adelphia.net. .. > Im having a formatting issue with mail(). > >My simple script looks like: > ..... >When it comes to my email client it appears as: > <strong>Hello blah@blah.com</strong> > >Instead of: > Hello blah@blah.com First of all: DO NOT send HTML mail to newsgroups!!! In your e-mail client there's a setting which allows you to select plain text a-mails for newsgroups and HTML for others. To answer your question: Use the the fourth argument of the mail() function to send a content type header with text/html as the value: mail($key, $subject, $message_to_send, "From: blah@blah.com\nContent-Type: text/html"); JW |
|
|||
|
Ok here is another question...
It would seem that the mail() is injecting a "! " in the text of $message_to_sender: So text that should read: There once were three bears that lived in a big black house. Would look like: There once were three bears that lived in a big blac! k house Does this look familiar? Does mail() have an issue with the size of the message being passed? If I increase the size of the text, the "! " will move accordingly (im guessing at char 255). "Esteban Fernández" <eft0@gmx.nospam.net> wrote in message news:3f0c7ed3@omega.ifxnw.cl... > Easy, just replace you mail line code, for thi one. > > mail($key, $subject, $message_to_send, "Content-Type: text/html\nFrom: > blah@blah.com"); > > Regards. > EF. > > > "Ryan Ramsey" <ryanramsey@yahoo.com> escribió en el mensaje > news:bhZOa.875$5o5.577540@news1.news.adelphia.net. .. > Im having a formatting issue with mail(). > > My simple script looks like: > > $key = blah@blah.com; > $subject = "My membership"; > $message_to_send = "<strong>Hello".$key."</strong>"; > > mail($key, $subject, $message_to_send, "From: blah@blah.com"); > > When it comes to my email client it appears as: > > <strong>Hello blah@blah.com</strong> > > Instead of: > > Hello blah@blah.com > > I have also tried adding <html> and <body> tags but that doesn't seem to do > anything. > I get other HMTL messages from amazon and such but it would appear that one > generated from mail() is sending only raw text. > How do I get it to format HTML based message? > > > |
|
|||
|
"Ryan Ramsey" <ryanramsey@yahoo.com> wrote in message news:xL0Pa.1079$5o5.639092@news1.news.adelphia.net ... > Ok here is another question... > > It would seem that the mail() is injecting a "! " in the text of > $message_to_sender: > > So text that should read: > > There once were three bears that lived in a big black house. > > Would look like: > > There once were three bears that lived in a big blac! k house > > Does this look familiar? Does mail() have an issue with the size of the > message being passed? If I increase the size of the text, the "! " will move > accordingly (im guessing at char 255). > A simple "Content-Type: text/html;charset=ISO-8859-1\n" should fix this. JW |
![]() |
| Thread Tools | |
| Display Modes | |
|
|