Re: email in html format?

From: Date: Thu, 20 Jul 2000 18:11:23 +0000
Subject: Re: email in html format?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-7456@lists.php.net to get a copy of this message
Thanx Andreas, This answer part of my question. I had a notion that adding the line breaks before sending the message might help the situation, and I'll more than likely use the script you provided to save me some trouble. But, the later part of my message which refers to the way the emails are displayed on my unix box is still unclear to me. When I view the source of a message which is sent in both html and text format from a different sender using netscape messenger I see both the 8bit version of both the html and text versions of the message, and I see the base 64 version of the messages. However when I view the source of the message using Richard's script, I only see the base 64 version. I do not know if this is relavent, but I am curious to know what causes this difference. Once again any info is taken to heart and appreciated thanx again. Tre' Andreas Pour wrote: > Tremayne Smith wrote: > > > > An associate and myself have used the script provided by Mr. Heyes to > > successfully send an html formatted email message. However; when a recipient > > only has the ability to read the text version, we have received complaints that > > the message is being displayed as a single string with no line breaks. > > Some e-mail clients insert line-breaks in incoming e-mail, others do > not. To be safe, it's a good idea to break lines in plain-text e-mails > before sending it. > > A little script which does this (I'm not saying it's the best, but it > works for me): > > // break lines that are too long and return the result > // 'str' is the text to be broken up > // 'length' is the max. number of characters per line > // returns the 'str' broken into lines > function breakLines($str, $length) > { > // make sure we deal only with newlines > $res = ""; > $str = ereg_replace("\r\n", "\n", $str); > $lines = explode("\n", $str); > $lsep = ""; > for (reset($lines); list(, $line) = each($lines); $lsep = "\n") > { > $line = chop($line); // trailing white space killed > if (strlen($line) > $length) > { > // search backwards in line for first char before 'length' which > // is a space > $words = explode(" ", $line); > $len = 0; > $wsep = ""; > $printnl = true; // need to print 'lsep' once > for (reset($words); list(, $word) = each($words); $wsep = " ") > { > $len += strlen($word . $wsep); > if ($len > $length) > { > if (strlen($word) > $length) > { > $res .= "\n" . chunk_split($word, $length, "\n"); > $len = strlen($res) - strrchr($res, "\n"); > } > else > { > $res .= "\n$word"; > $len = strlen($word); > } > } > else > $res .= ($printnl ? $lsep : "") . $wsep . $word; > $printnl = false; > } > } > else > $res .= $lsep . $line; > } > return $res; > } > > > If I > > send the text only version to myself using the mail function, I receive a > > properly formatted message. We have not received anymore info from the > > complainers as to which email client they were using. Also if I attempt to view > > a message sent using Mr. Heyes's script by typing mail at my Unix terminal, I > > get gibberish. > > > > I am a newbie to the protocol and encoding standards of email, so I have no idea > > where this problem could be originating. So any advice that anyone is willing > > to share will be greatly appreciated. Thanx in advance. > > > > Tre' > > > > Richard Heyes wrote: > > > > > > This appears to be exactly what I need. I appreciate your > > > > help, take care. > > > > > > Out of courtesy you might want to check though whether your subscribers wish > > > to recieve HTML mail. Personally I hate the stuff. :) > > > > > > Take care. > > > > > > -- > > > Richard Heyes > > > http://www.heyes-computing.net/scripts/ > > > Plain text email only please! > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#7456) next »