Exclamation points at odd places in php email.

Reply

Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Exclamation points at odd places in php email.

 
0
  #1
Apr 14th, 2007
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.
Last edited by nathanpacker; Apr 14th, 2007 at 8:44 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 187
Reputation: phper is an unknown quantity at this point 
Solved Threads: 15
phper's Avatar
phper phper is offline Offline
Junior Poster

Re: Exclamation points at odd places in php email.

 
0
  #2
Apr 14th, 2007
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)));
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Re: Exclamation points at odd places in php email.

 
0
  #3
Apr 14th, 2007
Originally Posted by phper View Post
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)));
Well I'm not getting any line breaks, just the exclamation points, but I'll look into that anyway.
Thanks.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Re: Exclamation points at odd places in php email.

 
0
  #4
Apr 20th, 2007
Ok, well I tried the base64 encoding, and I now the email just sends a bunch of jibberish, like this:

PGh0bWw+PGJvZHkgbGluaz0ibmF2eSIgdmxpbms9IiMwMDMzNjYiPjxjZW50ZXI+PHRhYmxlIHdp ZHRoPSIxMDAlIj48dHI+PHRkIHZhbGlnbj0iYm90dG9tIiB3aWR0aD0iNTAwIiBoZWlnaHQ9IjEw MCIgYmFja2dyb3...
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.
Last edited by nathanpacker; Apr 20th, 2007 at 10:57 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Re: Exclamation points at odd places in php email.

 
0
  #5
Apr 21st, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 160
Reputation: w_3rabi is an unknown quantity at this point 
Solved Threads: 8
w_3rabi's Avatar
w_3rabi w_3rabi is offline Offline
Junior Poster

Re: Exclamation points at odd places in php email.

 
0
  #6
Apr 29th, 2007
Originally Posted by nathanpacker View Post
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.
i havent tried to email in php before
but dont you need to use [php]base64_decode()[/php] somewhere
Last edited by w_3rabi; Apr 29th, 2007 at 5:11 am.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 1
Reputation: johnrenosh is an unknown quantity at this point 
Solved Threads: 0
johnrenosh johnrenosh is offline Offline
Newbie Poster

Re: Exclamation points at odd places in php email.

 
0
  #7
May 9th, 2009
Originally Posted by phper View Post
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)));
wow..... ur soln really helped me... i was really frustrated by the exclamation character in the mails ent by php mail().....

Thanks..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC