Problems with mail()

Posted: 07-09-2003, 06:36 PM
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?


Reply With Quote

Responses to "Problems with mail()"

Janwillem Borleffs
Guest
Posts: n/a
 
Re: Problems with mail()
Posted: 07-09-2003, 08:48 PM

"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



Reply With Quote
Ryan Ramsey
Guest
Posts: n/a
 
Re: Problems with mail()
Posted: 07-09-2003, 10:34 PM
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?
>
>
>

Reply With Quote
Janwillem Borleffs
Guest
Posts: n/a
 
Re: Problems with mail()
Posted: 07-10-2003, 11:11 AM

"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



Reply With Quote
 
LinkBack Thread Tools Search this Thread Display Modes
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CDO mail extension problem gtsilimigkas Macromedia Exchange Dreamweaver Extensions 2 06-05-2005 05:03 PM
CDO mail extension problem 02 gtsilimigkas Macromedia Exchange Dreamweaver Extensions 1 03-04-2005 06:29 PM
permission problems -help!! Lou28 Macromedia Exchange Dreamweaver Extensions 0 03-03-2005 07:50 AM
30 Day trial problems JavJon Macromedia Contribute General Discussion 1 02-22-2005 03:14 PM
Text Problems Andrew Morton Macromedia Director Basics 6 02-26-2004 06:05 PM