| | |
Exclamation points at odd places in php email.
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hey, I have a script that sends a user an html-formatted email. Usually once per email, there is an exclamation point popping up in the middle of the email. I've read somewhere about this happening because of some limit at 1000 character limit, and it could be around that point, I'm too lazy to count. But assuming it is, how do I sto!p this f!reaking exlamation point fro!m poping up?!
Also, they don't happen every time. I'd estimate 2 out of every 10 emails don't have the rogue exclamation point.
Also, they don't happen every time. I'd estimate 2 out of every 10 emails don't have the rogue exclamation point.
Last edited by nathanpacker; Apr 14th, 2007 at 8:44 am.
If you are seeing unwanted line breaks preceded by exclamation marks ("!") in the emails you send with mail(), you may be having the same problem I had: exceeding the maximum line length (998 chars) specified in RFC 2822 (http://www.faqs.org/rfcs/rfc2822.html).
You can get around this restriction by using base64 encoding: add a "Content-Transfer-Encoding: base64" header and encode the contents with
$base64contents = rtrim(chunk_split(
base64_encode($contents)));
You can get around this restriction by using base64 encoding: add a "Content-Transfer-Encoding: base64" header and encode the contents with
$base64contents = rtrim(chunk_split(
base64_encode($contents)));
•
•
•
•
If you are seeing unwanted line breaks preceded by exclamation marks ("!") in the emails you send with mail(), you may be having the same problem I had: exceeding the maximum line length (998 chars) specified in RFC 2822 (http://www.faqs.org/rfcs/rfc2822.html).
You can get around this restriction by using base64 encoding: add a "Content-Transfer-Encoding: base64" header and encode the contents with
$base64contents = rtrim(chunk_split(
base64_encode($contents)));
Thanks.
Ok, well I tried the base64 encoding, and I now the email just sends a bunch of jibberish, like this:
Anyway, I'm not even sure I was doing it right, maybe you could look at my mail code here, and tell me if I was incorporating it correctly. I've got the entire email content stored in a variable called $msg. After putting together the message, I have this code:
[PHP]$msg = rtrim(chunk_split(
base64_encode($msg)));
@mail($to, $subject, $msg, "From: $from\nContent-Type: text/html; charset=iso-8859-1; Content-Transfer-Encoding: base64");[/PHP]
So let me know if I'm not doing it right. These exclamation points are killing me! Thanks.
•
•
•
•
PGh0bWw+PGJvZHkgbGluaz0ibmF2eSIgdmxpbms9IiMwMDMzNjYiPjxjZW50ZXI+PHRhYmxlIHdp ZHRoPSIxMDAlIj48dHI+PHRkIHZhbGlnbj0iYm90dG9tIiB3aWR0aD0iNTAwIiBoZWlnaHQ9IjEw MCIgYmFja2dyb3...
[PHP]$msg = rtrim(chunk_split(
base64_encode($msg)));
@mail($to, $subject, $msg, "From: $from\nContent-Type: text/html; charset=iso-8859-1; Content-Transfer-Encoding: base64");[/PHP]
So let me know if I'm not doing it right. These exclamation points are killing me! Thanks.
Last edited by nathanpacker; Apr 20th, 2007 at 10:57 pm.
I've just noticed that I think it is inserting line breaks, but they're not showing up in the email itself, because they're not html <br>, but probably something like a \n or something like that. And the exclamation point isn't showing up much anymore, but a space is, and the annoying thing is, it's now happening right around or in a hyperlink, which obviously screws up the hyperlink! Well I've inserted some characters to shove it out of the way of the hyperlink for now, but this has got to stop.
Anyway, so if I need to do something else to stop this, let me know.
Thanks.
Anyway, so if I need to do something else to stop this, let me know.
Thanks.
•
•
•
•
Ok, well I tried the base64 encoding, and I now the email just sends a bunch of jibberish, like this:
Anyway, I'm not even sure I was doing it right, maybe you could look at my mail code here, and tell me if I was incorporating it correctly. I've got the entire email content stored in a variable called $msg. After putting together the message, I have this code:
[php]$msg = rtrim(chunk_split(
base64_encode($msg)));
@mail($to, $subject, $msg, "From: $from\nContent-Type: text/html; charset=iso-8859-1; Content-Transfer-Encoding: base64");[/php]
So let me know if I'm not doing it right. These exclamation points are killing me! Thanks.
but dont you need to use [php]base64_decode()[/php] somewhere
Last edited by w_3rabi; Apr 29th, 2007 at 5:11 am.
•
•
Join Date: May 2009
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
If you are seeing unwanted line breaks preceded by exclamation marks ("!") in the emails you send with mail(), you may be having the same problem I had: exceeding the maximum line length (998 chars) specified in RFC 2822 (http://www.faqs.org/rfcs/rfc2822.html).
You can get around this restriction by using base64 encoding: add a "Content-Transfer-Encoding: base64" header and encode the contents with
$base64contents = rtrim(chunk_split(
base64_encode($contents)));
Thanks..
![]() |
Similar Threads
- PHP Email (PHP)
- PHP email problem (PHP)
Other Threads in the PHP Forum
- Previous Thread: Deleting Entry From MySQL Table
- Next Thread: variable in URL called from database
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





