Re: [PHP] html email showing br instead of line breaks
\r\n should be between double quotes: \r\n On Thu, Sep 24, 2009 at 3:52 PM, Adam Williams awill...@mdah.state.ms.us wrote: I have users enter support tickets into a a textarea form and then it emails it to me, I'm trying to get the emails to display when they hit enter correctly, so i'm changing the \r\n to br, but in the email i'm getting, its displaying the br instead of a line break: here is the code: $message = htmlheadtitlenew support request #.mysqli_insert_id($mysqli)./title/headbodyp Hello, .$_SESSION[full_name]. has created a new support request. Please log in at a href=\http://intra/helpdesk\;MDAH Helpdesk/a. The problem request is \; $message .= htmlspecialchars(str_replace('\r\n', 'br', $_POST[problem])); $message .= \ and the best time to contact is \.htmlspecialchars($_POST[contact_time]).\ /p/body/html; $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $headers .= From: .$_SESSION[full_name]..$_SESSION[username].@mdah.state.ms.us .\r\n . X-Mailer: PHP/ . phpversion(); mail('isst...@mdah.state.ms.us', $subject, $message, $headers); but the email I get is: Hello, Karen Redhead has created a new support request. Please log in at MDAH Helpdesk http://intra/helpdesk. The problem request is Elaine is out today but her computer no longer has Past Perfect from what I can tell. Also how does she access her email. The Sea Monkey email icon does not take you anywhere.brThanks so much,brKaren and the best time to contact is 1:30 -5:00 How come the email is being displayed with br instead of line breaks? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html email showing br instead of line breaks
Thanks, i'll try that. what is the difference in using '' and ? I thought they were interchangeable. Jonathan Tapicer wrote: \r\n should be between double quotes: \r\n -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html email showing br instead of line breaks
oh nevermind, i see double quotes translate the \r\n to its appropriate EOL character. Adam Williams wrote: Thanks, i'll try that. what is the difference in using '' and ? I thought they were interchangeable. Jonathan Tapicer wrote: \r\n should be between double quotes: \r\n -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html email showing br instead of line breaks
Double quotes accept special characters and string interpolation, see the manual: http://php.net/manual/en/language.types.string.php On Thu, Sep 24, 2009 at 4:00 PM, Adam Williams awill...@mdah.state.ms.us wrote: Thanks, i'll try that. what is the difference in using '' and ? I thought they were interchangeable. Jonathan Tapicer wrote: \r\n should be between double quotes: \r\n -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html email showing br instead of line breaks
Have you tried http://es.php.net/manual/en/function.nl2br.php ? I think it's easier and fits your needs. De: Adam Williams awill...@mdah.state.ms.us Para: PHP General list php-general@lists.php.net Enviado: jueves, 24 de septiembre, 2009 20:52:13 Asunto: [PHP] html email showing br instead of line breaks I have users enter support tickets into a a textarea form and then it emails it to me, I'm trying to get the emails to display when they hit enter correctly, so i'm changing the \r\n to br, but in the email i'm getting, its displaying the br instead of a line break: here is the code: $message = htmlheadtitlenew support request #.mysqli_insert_id($mysqli)./title/headbodyp Hello, .$_SESSION[full_name]. has created a new support request. Please log in at a href=\http://intra/helpdesk\;MDAH Helpdesk/a. The problem request is \; $message .= htmlspecialchars(str_replace('\r\n', 'br', $_POST[problem])); $message .= \ and the best time to contact is \.htmlspecialchars($_POST[contact_time]).\ /p/body/html; $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $headers .= From: .$_SESSION[full_name]..$_SESSION[username].@mdah.state.ms.us .\r\n . X-Mailer: PHP/ . phpversion(); mail('isst...@mdah.state.ms.us', $subject, $message, $headers); but the email I get is: Hello, Karen Redhead has created a new support request. Please log in at MDAH Helpdesk http://intra/helpdesk. The problem request is Elaine is out today but her computer no longer has Past Perfect from what I can tell. Also how does she access her email. The Sea Monkey email icon does not take you anywhere.brThanks so much,brKaren and the best time to contact is 1:30 -5:00 How come the email is being displayed with br instead of line breaks?
Re: [PHP] html email showing br instead of line breaks
\r\n should be between double quotes: \r\n I think you'll still see the literal brs in your final email, though because htmlspecialchars() is converting the angle-brackets in the tag to their respective HTML entities (lt; for and gt; for ). A bit of a thorny problem because you probably do want to escape HTML-characters in the message for security purposes. I suppose you could call str_replace() after htmlspecialchars(), instead of before it as you currently do. OTOH, why not just send your email as plain text, instead of HTML? Thanks, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Email Composing Problem.
Tom Ray [Lists] wrote: Chris wrote: Richard Lynch wrote: On Thu, July 26, 2007 2:46 pm, Tom Ray [Lists] wrote: I'm trying to use PHP to compose an HTML formatted email Don't do that... 3) Spam Assassin doesn't like it either way and tags the email as SPAM for the following reasons: 0.6 HTML_SHORT_LENGTH BODY: HTML is extremely short 0.0 HTML_MESSAGE BODY: HTML included in message 1.5 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding snip However, I would still like to get answers on questions 1 and 2 for future reference so any thoughts would be great. They're pretty self explanatory. 1) Make your message longer 2) Your message contains html. Your rules are set up to flag anything with html as spam. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Email Composing Problem.
Richard Lynch wrote: On Thu, July 26, 2007 2:46 pm, Tom Ray [Lists] wrote: I'm trying to use PHP to compose an HTML formatted email Don't do that... 3) Spam Assassin doesn't like it either way and tags the email as SPAM for the following reasons: 0.6 HTML_SHORT_LENGTH BODY: HTML is extremely short 0.0 HTML_MESSAGE BODY: HTML included in message 1.5 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding The only people who send out these stupid HTML enhanced (cough, cough) messages are spammers. Pfft. There are tons of legitimate reasons to send html emails. To get rid of the last one, don't base_64 encode your html content. You only need to base64_encode embedded images or attachments (pdf's, docs, stuff like that). As someone else suggested, check out phpmailer - it handles all this for you and works pretty nicely. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Email Composing Problem.
0.6 HTML_SHORT_LENGTH BODY: HTML is extremely short Well, lengthen it then. 1.5 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding Don't do that. Use plain text or quoted printable. Any help/suggestions would be appreciated. Try HTML MIME mail - it does every thing for you: http://www.phpguru.org/static/htmlMimeMail5.html -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Email Composing Problem.
Chris wrote: Richard Lynch wrote: On Thu, July 26, 2007 2:46 pm, Tom Ray [Lists] wrote: I'm trying to use PHP to compose an HTML formatted email Don't do that... 3) Spam Assassin doesn't like it either way and tags the email as SPAM for the following reasons: 0.6 HTML_SHORT_LENGTH BODY: HTML is extremely short 0.0 HTML_MESSAGE BODY: HTML included in message 1.5 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding The only people who send out these stupid HTML enhanced (cough, cough) messages are spammers. Pfft. There are tons of legitimate reasons to send html emails. To get rid of the last one, don't base_64 encode your html content. You only need to base64_encode embedded images or attachments (pdf's, docs, stuff like that). As someone else suggested, check out phpmailer - it handles all this for you and works pretty nicely. I would have to agree with you Chris, there a many legitimate reasons for having HTML mail. I was trying to be a nice guy and send both the plain text version and the html version out but like I said, I couldn't get it to stop displaying both. I dumped the base_64 encoding already and also gave up on trying to do a multipart/mixed with both plain text and html and am just composing them as plain text or html as needed. PHPMailer is great for a resource but this is a customized project and PHPMailer won't fit in it. Plus I really would like to have this knowledge rattlin' around in my head anyways. It all works with Yahoo, Gmail and Hotmail. It displays properly and isn't shoved into the Junk/Spam folders. Everything displays right in Thunderbird and Outlook Express and the only time it's flagged as spam is if it goes through my main account which, in reality, has a insanely low score base (.5) and it's now scoring a .6 so I think I've got a solution. However, I would still like to get answers on questions 1 and 2 for future reference so any thoughts would be great. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Email Composing Problem.
On Fri, July 27, 2007 11:01 am, Tom Ray [Lists] wrote: I would have to agree with you Chris, there a many legitimate reasons for having HTML mail. I was trying to be a nice guy and send both the plain text version and the html version out but like I said, I couldn't get it to stop displaying both. Just set up two different mailing lists (internally) and when a user subscribes they can pick html/plain and you subscribe them to the correct list. PS There may be legitimate reasons why somebody thinks they need to send me HTML enhanced (cough, cough) email, but I've personally NEVER found one that had sufficient added value to make it worth receiving as HTML enhanced (cough, cough) email. YMMV -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Email Composing Problem.
On Thu, July 26, 2007 2:46 pm, Tom Ray [Lists] wrote: I'm trying to use PHP to compose an HTML formatted email Don't do that... 3) Spam Assassin doesn't like it either way and tags the email as SPAM for the following reasons: 0.6 HTML_SHORT_LENGTH BODY: HTML is extremely short 0.0 HTML_MESSAGE BODY: HTML included in message 1.5 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding The only people who send out these stupid HTML enhanced (cough, cough) messages are spammers. Okay, and people not clueful enough to turn off HTML in bad email clients that default it on, so that they can send a zero-value-added email with the HTML enhancment (cough, cough). Still, the point is that you will most likely never ever fix problem 3. [opinion] HTML enhanced email is a blight up on the universe and should be eradicated whenever and wherever possible. [/opinion] YMMV NAIAA -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email enconding
On Mon, Nov 24, 2003 at 02:56:25PM +0530, Binay wrote: : : Is it necessary to encode the message using base64 or quoted-printable : format while sending the HTML email. Not always. Sometimes you can get away with only: Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit : What if i don't encode the message i.e (no Content-Transfer-Encoding : specified)? Does it impose some security vulnerabilities? These headers just provide more information to the mail client so that it can properly handle and display the message. Some mail clients may be more error-tolerant than others. But really you don't want your messages to be handled and displayed incorrectly. Just as your PHP code should generate HTML-compliant web pages, your code should also generate correctly format email messages. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email enconding
Hi Eugene, Thanks for quick reply So does it mean that if i don't encode the message then no need of specifying the Content-Transfer-Encoding?? And almost all mail client will interpret it correctly?? Binay - Original Message - From: Eugene Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 24, 2003 3:02 PM Subject: Re: [PHP] HTML email enconding On Mon, Nov 24, 2003 at 02:56:25PM +0530, Binay wrote: : : Is it necessary to encode the message using base64 or quoted-printable : format while sending the HTML email. Not always. Sometimes you can get away with only: Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit : What if i don't encode the message i.e (no Content-Transfer-Encoding : specified)? Does it impose some security vulnerabilities? These headers just provide more information to the mail client so that it can properly handle and display the message. Some mail clients may be more error-tolerant than others. But really you don't want your messages to be handled and displayed incorrectly. Just as your PHP code should generate HTML-compliant web pages, your code should also generate correctly format email messages. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email enconding
On Mon, Nov 24, 2003 at 03:33:57PM +0530, Binay wrote: : : So does it mean that if i don't encode the message then no need of : specifying the Content-Transfer-Encoding?? : And almost all mail client will interpret it correctly?? No. If your HTML message is guaranteed to be in the ISO-8859-1 range (e.g. only Latin-based languages), then you could likely get away with just these two headers. But you still need to specify both of them. : Content-Type: text/html; charset=ISO-8859-1 : Content-Transfer-Encoding: 7bit You need to follow the various RFCs to generate correct messsages. If you don't have time for that, I suggest you look at existing classes like PEAR's Mail_Mime package that does much of the work for you: http://pear.php.net/package/Mail_Mime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email enconding
There is a nice function called sendmail available in the comments on php.net/mail. I use that regularly as it inserts all the necessary headers and supports multiple attachments. It's well worth considering... Nathan - Original Message - From: Eugene Lee To: [EMAIL PROTECTED] Sent: Monday, November 24, 2003 5:19 AM Subject: Re: [PHP] HTML email enconding On Mon, Nov 24, 2003 at 03:33:57PM +0530, Binay wrote: : : So does it mean that if i don't encode the message then no need of : specifying the Content-Transfer-Encoding?? : And almost all mail client will interpret it correctly?? No. If your HTML message is guaranteed to be in the ISO-8859-1 range (e.g. only Latin-based languages), then you could likely get away with just these two headers. But you still need to specify both of them. : Content-Type: text/html; charset=ISO-8859-1 : Content-Transfer-Encoding: 7bit You need to follow the various RFCs to generate correct messsages. If you don't have time for that, I suggest you look at existing classes like PEAR's Mail_Mime package that does much of the work for you: http://pear.php.net/package/Mail_Mime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML email problem
When I send HTML emails, I don't base64 encode it, I just set the content-type to text/html. The mail clients that I've tested it with renders it correctly HTH Martin I m sendig out HTML email, using mimemail class which encodes the whole message to be sent in base64 and Content-Transfer-Encoding: is also specified as base64 only. Now one of my client is complaining that he is getting garbage in the email (shown below) after the sign up process in the site. // ** his is a MIME encoded message. --b159a63cb0da408dc58f11f5895832e92 Content-Type: text/html Content-Transfer-Encoding: base64 PEhUTUw+DQoJCQkJCSAJPPEI+TE9HSU4gSU5GT1JNQVRJT04gPC9URD48L1RSP g0KCQkJCQkJPFRSP jxURD48Zm9udCBmYWNlPWFyaWFsIHNpemU9Mj5Vc2VybmFtZSA6 IDwvVEQ+PFREPjxmb250IGZhY2U9YXJpYWwgc2l6ZT0yPmJpbmF5QG9saXZlaW 50ZXJuZXQuY29t PC9URD48L1RSPg0KCQkJCQkJPFRSPjxURD48Zm9udCBmYWNlPWFyaWFsIHNpem U9Mj5QYXNzd29y ZCA6IDwvVEQ+PFREPjxmb250IGZhY2U9YXJpYWwgc2l6ZT0yPm9saXZlPC9URD 48L1RSPg0KCQkJ CQkJPC9UQUJMRT4NCgkJCQkJCTwvQk9EWT4NCgkJCQkJIDwvSFRNTD4= --b159a63cb0da408dc58f11f5895832e92-- // *** I figured out why this is happening as his(client's) email programme does not support base64 encoding hence could not able to decode the message. I can't send the text email as it contains links and other html stuff.. Please suggest me what i can do? Is there any mail class which takes care of this problem? Thanks in advance Binay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email with Outlook
I would take a look at the headers of an email that does render html correctly in outlook and see what you are missing. Trial and error. Jim Lucas - Original Message - From: Tim Thorburn [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 3:48 PM Subject: [PHP] HTML email with Outlook Hi, I've made a PHP script that sends out an automatic email through my servers cron system, it works well, but I thought I'd try to do some HTML email to get things to line up a little better. To do so, I added the following line in my mail() command: -Type: text/html; charset=iso-8859-1 When I check the messages sent out with Eudora, the HTML email comes in perfectly. However, when I check with Outlook Express 6 - I get the actual HTML code rather than the nicely formatted email that I had created. Should I be using another line in my mail() command? I've recieved HTML email before with Outlook Express on my machine without changing any settings at all. Also, I had sent an email from my script to hotmail and the HTML email worked fine there too. Any thoughts? Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email with Outlook
Hi, try with adding this : $header = Content-Type: text/html; charset=\iso-8859-1\\nContent-Transfer-Encoding: 8bit\n\n; If it don't work, try to build multipart email ... Regards, P.E. Baroiller Tim Thorburn [EMAIL PROTECTED] a écrit dans le message de news:[EMAIL PROTECTED] Hi, I've made a PHP script that sends out an automatic email through my servers cron system, it works well, but I thought I'd try to do some HTML email to get things to line up a little better. To do so, I added the following line in my mail() command: -Type: text/html; charset=iso-8859-1 When I check the messages sent out with Eudora, the HTML email comes in perfectly. However, when I check with Outlook Express 6 - I get the actual HTML code rather than the nicely formatted email that I had created. Should I be using another line in my mail() command? I've recieved HTML email before with Outlook Express on my machine without changing any settings at all. Also, I had sent an email from my script to hotmail and the HTML email worked fine there too. Any thoughts? Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML email with Outlook
$headers = MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; Does this help? Johnny -Original Message- From: Tim Thorburn [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 3:48 PM To: [EMAIL PROTECTED] Subject: [PHP] HTML email with Outlook Hi, I've made a PHP script that sends out an automatic email through my servers cron system, it works well, but I thought I'd try to do some HTML email to get things to line up a little better. To do so, I added the following line in my mail() command: -Type: text/html; charset=iso-8859-1 When I check the messages sent out with Eudora, the HTML email comes in perfectly. However, when I check with Outlook Express 6 - I get the actual HTML code rather than the nicely formatted email that I had created. Should I be using another line in my mail() command? I've recieved HTML email before with Outlook Express on my machine without changing any settings at all. Also, I had sent an email from my script to hotmail and the HTML email worked fine there too. Any thoughts? Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email with Outlook
Tim Thorburn [EMAIL PROTECTED] wrote: Hi, I've made a PHP script that sends out an automatic email through my servers cron system, it works well, but I thought I'd try to do some HTML email to get things to line up a little better. To do so, I added the following line in my mail() command: -Type: text/html; charset=iso-8859-1 When I check the messages sent out with Eudora, the HTML email comes in perfectly. However, when I check with Outlook Express 6 - I get the actual HTML code rather than the nicely formatted email that I had created. Should I be using another line in my mail() command? I've recieved HTML email before with Outlook Express on my machine without changing any settings at all. Also, I had sent an email from my script to hotmail and the HTML email worked fine there too. there are different ways to send html in an email and also very wrong ways to send html in an email; very debatable topic from what I've seen. I think your best bet is to use something like: http://phpmailer.sourceforge.net/ You can send both plain/text and html. Remember not all email clients support email. And a lot of people dont like it at all. Of course if this is only for you to see I guess you can ignore all that i said :) Curt -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML email with Outlook
Remember not all email clients support email. Did I read that right or is it a typo? J -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 4:17 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] HTML email with Outlook Tim Thorburn [EMAIL PROTECTED] wrote: Hi, I've made a PHP script that sends out an automatic email through my servers cron system, it works well, but I thought I'd try to do some HTML email to get things to line up a little better. To do so, I added the following line in my mail() command: -Type: text/html; charset=iso-8859-1 When I check the messages sent out with Eudora, the HTML email comes in perfectly. However, when I check with Outlook Express 6 - I get the actual HTML code rather than the nicely formatted email that I had created. Should I be using another line in my mail() command? I've recieved HTML email before with Outlook Express on my machine without changing any settings at all. Also, I had sent an email from my script to hotmail and the HTML email worked fine there too. there are different ways to send html in an email and also very wrong ways to send html in an email; very debatable topic from what I've seen. I think your best bet is to use something like: http://phpmailer.sourceforge.net/ You can send both plain/text and html. Remember not all email clients support email. And a lot of people dont like it at all. Of course if this is only for you to see I guess you can ignore all that i said :) Curt -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML email with Outlook
By the context, I'm sure it should read ...not all email clients support HTML. (I got a laugh out of it though ;) -Original Message- From: Johnny Martinez [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 7:21 PM To: 'Curt Zirzow'; [EMAIL PROTECTED] Subject: RE: [PHP] HTML email with Outlook Remember not all email clients support email. Did I read that right or is it a typo? J -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 4:17 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] HTML email with Outlook Tim Thorburn [EMAIL PROTECTED] wrote: Hi, I've made a PHP script that sends out an automatic email through my servers cron system, it works well, but I thought I'd try to do some HTML email to get things to line up a little better. To do so, I added the following line in my mail() command: -Type: text/html; charset=iso-8859-1 When I check the messages sent out with Eudora, the HTML email comes in perfectly. However, when I check with Outlook Express 6 - I get the actual HTML code rather than the nicely formatted email that I had created. Should I be using another line in my mail() command? I've recieved HTML email before with Outlook Express on my machine without changing any settings at all. Also, I had sent an email from my script to hotmail and the HTML email worked fine there too. there are different ways to send html in an email and also very wrong ways to send html in an email; very debatable topic from what I've seen. I think your best bet is to use something like: http://phpmailer.sourceforge.net/ You can send both plain/text and html. Remember not all email clients support email. And a lot of people dont like it at all. Of course if this is only for you to see I guess you can ignore all that i said :) Curt -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email with Outlook
Hello, On 07/15/2003 07:48 PM, Tim Thorburn wrote: I've made a PHP script that sends out an automatic email through my servers cron system, it works well, but I thought I'd try to do some HTML email to get things to line up a little better. To do so, I added the following line in my mail() command: -Type: text/html; charset=iso-8859-1 When I check the messages sent out with Eudora, the HTML email comes in perfectly. However, when I check with Outlook Express 6 - I get the actual HTML code rather than the nicely formatted email that I had created. Should I be using another line in my mail() command? I've recieved HTML email before with Outlook Express on my machine without changing any settings at all. Also, I had sent an email from my script to hotmail and the HTML email worked fine there too. That looks like one of the bugs of the mail() function that never got fixed. In that case you may want to try this class that has built-in workarounds for some of the mail() function bugs. http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email with Outlook
Thanks to all those who responded, as always, spelling is key. Where I had -Type: text/html ... it should have read Content-Type : text/html ... So it works for now, and hopefully will continue to. I know that there are a number of email programs out there that do not support HTML mail, as well I know there are a great many of individuals who do not enjoy it either. We're just running a trial base here to see what works, if it turns out that the majority of our customers do not enjoy it, then we'll switch to plain text (actually built the plain-text one first, this is just an add-on) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML email that generates !s - any ideas?
Hi, Thursday, January 9, 2003, 7:31:35 AM, you wrote: PH Hi everyone, I am new to this list, so this is my first post. PH I am trying to sen dan HTML email, and so far I got everything running, PH except for one very odd problem. PH 1.) I am setting up all my variables within the .php Script. PH 2.) I generate my HTML email PH 3.) I am outputting the email to the browser and send it to myself -- Now here comes the problem: PH In the browseroutput the text looks like I want it to be. In the email PH however, PH there are several EXCLAMATION MARKS (!) added to the code (and therefore PH the body). PH How can this happen?? Is there some trick I have missed? The exclamation PH marks are PH positioned within the email according to the amaount of characters I submit PH with the PH email. PH I have set up a simple page where you can view the .php file, the output and PH the email. PH http://www.gsdh.org/pleasehelp/index.html PH If anyone of you could spare the time, I would be really gratefull as I have PH to finish this but am PH stuck! :( PH Thans again, PH Philipp What happens if you paste the php output directly into your mailer ? -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML email that generates !s - any ideas?
You need to set an encoding and encode the body see: http://www.php.net/manual/en/function.imap-8bit.php **You will need to add the headers for this plus encode** Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED]] Sent: Thursday, 9 January 2003 9:49 AM To: Philipp Hartmann Cc: [EMAIL PROTECTED] Subject: Re: [PHP] HTML email that generates !s - any ideas? Hi, Thursday, January 9, 2003, 7:31:35 AM, you wrote: PH Hi everyone, I am new to this list, so this is my first post. PH I am trying to sen dan HTML email, and so far I got everything PH running, except for one very odd problem. PH 1.) I am setting up all my variables within the .php Script. PH 2.) I generate my HTML email PH 3.) I am outputting the email to the browser and send it to myself -- Now here comes the problem: PH In the browseroutput the text looks like I want it to be. In the PH email however, there are several EXCLAMATION MARKS (!) added to PH the code (and therefore the body). PH How can this happen?? Is there some trick I have missed? The exclamation PH marks are PH positioned within the email according to the amaount of characters I submit PH with the PH email. PH I have set up a simple page where you can view the .php file, the PH output and the email. PH http://www.gsdh.org/pleasehelp/index.html PH If anyone of you could spare the time, I would be really gratefull PH as I have to finish this but am stuck! :( PH Thans again, PH Philipp What happens if you paste the php output directly into your mailer ? -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Email Has Random '!'
Thanks Martin, That was indeed the problem! I simply added a '\n' to the end of each line. And since html doesn't recognize it, it does no harm to the formatting. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Sunday, February 24, 2002, at 06:26 PM, Martin Towell wrote: it's to do with the length of a line - I think it's 1024 - if a lines longer than that, an ! is put there and a new line is made Martin -Original Message- From: Steven Walker [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 1:18 PM To: [EMAIL PROTECTED] Subject: [PHP] HTML Email Has Random '!' Hi, Has anybody every had problems with random characters showing up in HTML email messages? I've set up an auto-responding email system for product purchasing and registration. The system sends multipart HTML and plain text messages using mail(). However, exclamation points are showing up in random places. I have no idea where they come from... over and over I've looked at my source code but can't find any correlation. For example, here's a clip from an email message: Support: If you need any assistance, or would like to arrange another method of delivery, please conta! ct: And the code that generates this text looks like: $email_html .= /b/fontfont face=\Verdana, Arial, Helvetica, sans-serif\ size=\2\ color=\#33\; $email_html .= If you need any assistance, or would like to arrange another method ofbrdelivery, please contact:; $email_html .= /font/ppa href=\mailto:[EMAIL PROTECTED]\;; Sorry this is so hard to read... but the point is that the '!' is not in my code. When I make subtle changes to the code, the '!' shows up in other places. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML Email Has Random '!'
it's to do with the length of a line - I think it's 1024 - if a lines longer than that, an ! is put there and a new line is made Martin -Original Message- From: Steven Walker [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 1:18 PM To: [EMAIL PROTECTED] Subject: [PHP] HTML Email Has Random '!' Hi, Has anybody every had problems with random characters showing up in HTML email messages? I've set up an auto-responding email system for product purchasing and registration. The system sends multipart HTML and plain text messages using mail(). However, exclamation points are showing up in random places. I have no idea where they come from... over and over I've looked at my source code but can't find any correlation. For example, here's a clip from an email message: Support: If you need any assistance, or would like to arrange another method of delivery, please conta! ct: And the code that generates this text looks like: $email_html .= /b/fontfont face=\Verdana, Arial, Helvetica, sans-serif\ size=\2\ color=\#33\; $email_html .= If you need any assistance, or would like to arrange another method ofbrdelivery, please contact:; $email_html .= /font/ppa href=\mailto:[EMAIL PROTECTED]\;; Sorry this is so hard to read... but the point is that the '!' is not in my code. When I make subtle changes to the code, the '!' shows up in other places. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED]
Re: [PHP] HTML Email attachment problem
check out one of many HTML email scripts on hotscripts.com. --- Peter Atkins [EMAIL PROTECTED] wrote: All, I'm building a tool that takes form input and sends out an html email with a word doc attached. It sends the text and html version of the email but I can't open the attachment. It opens blank. Anyone have a thought or two about this? php snippet if ($attachment) { $fp = fopen($attachment, rb); $data = fread($fp, filesize($attachment)); $data = chunk_split(base64_encode($data)); fclose($fp); // add the MIME data $str .= -- . $boundary . \r\n; $str .= Content-Type: application/octet-stream; name=\ . $attachment .\\r\n; $str .= Content-Transfer-Encoding: base64\r\n; $str .= Content-Disposition: attachment; filename=\ . $attachment .\\r\n\r\n; $str .= $data . \r\n; } /php snippet thanks, -p -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] = Anas Mughal [EMAIL PROTECTED] [EMAIL PROTECTED] Tel: 973-249-6665 __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTML Email
The very first thing you need to do when thinking about a way to send HTML e-mail is to take plenty of aspirin and lie down until the urge passes and you feel sane again. HTML e-mail bad. Plain text good. At 06:51 AM 12/18/2001, Gerard Onorato wrote: Okay I know I must be overlooking somethign super obvious but I am trying to send a simple HTML email. It works in Netscape mail, Pegasus etc however in Outlook and Outlook express it actually places the Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] HTML Email
Okay I know I must be overlooking somethign super obvious but I am trying to send a simple HTML email. It works in Netscape mail, Pegasus etc however in Outlook and Outlook express it actually places the Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit in the body of the email all displays all the HTML instead of showing the email as a web page. I ahev inserted the code below. I know it is something stupid, so please help. Try the mime mail class at the url below and see if it helps. http://www.phpguru.org -- Richard Heyes If you have any trouble sounding condescending, find a Unix user to show you how it's done. - Scott Adams -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTML Email
It looks fine to me. The only difference is that I use Content-Transfer-Encoding: quoted-printable, which shouldn't make much of a difference here. A very small misplacement of a newline character or even a space can cause things not to work correctly. Your best course of debugging is to send a successful (look for a send this page as email link) HTML email to your outlook account. Open the message in a new window and inspect the headers carefully. Then you try to mimic that. In the end I skip using php's mail() function and use a socket connection and speak directly with the SMTP host. It all seems so easy in the beginning, but as soon as you start testing your html email in different email programs you realize that they all behave slight differently. The differences between Eudora, Outlook, Hotmail, AOL, Yahoo, Pine, etc are enough to drive you nuts. For more info read this: http://www.arsdigita.com/asj/mime/ jim Okay I know I must be overlooking somethign super obvious but I am trying to send a simple HTML email. It works in Netscape mail, Pegasus etc however in Outlook and Outlook express it actually places the Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit in the body of the email all displays all the HTML instead of showing the email as a web page. I ahev inserted the code below. I know it is something stupid, so please help. if ($htmlEmail) { $headers = MIME-Version: 1.0\r\n; $headers .= Content-Type: text/html; charset=iso-8859-1\r\n; $headers .= Content-Transfer-Encoding: 7bit . \r\n; $body = $html_body; } $headers .= From: $from\r\n\; ($cc != )?($headers .= Cc: $cc\r\n):(); ($bcc != )?($headers .= Bcc: $bcc\r\n):(); mail($email, $subject, $body, $headers); Anyone see what I am doing wrong? Thanks in advance! Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Jim Musil - Multimedia Programmer Nettmedia - 212-629-0004 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTML Email
Eureka! That seems to have fixed the problem. Now to test on the Mac clients. G On Tue, 18 Dec 2001 23:11:31 +0100, TD - Sales International Holland B.V. wrote: On Tuesday 18 December 2001 15:51, you wrote: Ok, just a guess here I'm not that familiar with writting my own headers What I THINK that might help is using only \n for a newline and not the \r. \r is windoze stuff while the first mta's (mail transfer agents) where unix systems. Perhaps that's your problem... then again, it's just a guess :-) If this is true, your probably only need that for the headers and not for the content of the email, since if you'd write an email in outlook express and press enter in it it should be a CRLF (\r\n) regards Okay I know I must be overlooking somethign super obvious but I am trying to send a simple HTML email. It works in Netscape mail, Pegasus etc however in Outlook and Outlook express it actually places the Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit in the body of the email all displays all the HTML instead of showing the email as a web page. I ahev inserted the code below. I know it is something stupid, so please help. if ($htmlEmail) { $headers = MIME-Version: 1.0\r\n; $headers .= Content-Type: text/html; charset=iso-8859-1\r\n; $headers .= Content-Transfer-Encoding: 7bit . \r\n; $body = $html_body; } $headers .= From: $from\r\n\; ($cc != )?($headers .= Cc: $cc\r\n):(); ($bcc != )?($headers .= Bcc: $bcc\r\n):(); mail($email, $subject, $body, $headers); Anyone see what I am doing wrong? Thanks in advance! Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]