Search The ForumSearch   RegisterRegister  LoginLogin

MailBee POP3

 AfterLogic Forum : MailBee POP3
Subject Topic: objMsgs.BodyText and ASP and SQL Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
noamway
Newbie
Newbie


Joined: 24 May 2007
Online Status: Offline
Posts: 15
Posted: 04 February 2008 at 2:41pm | IP Logged Quote noamway

Hello,

I have a very weird problem with getting emails with special character.

This is what I'm doing:
1. Get emails into Mailenable.
2. Output the emails with MailBee.POP3(ASP).
3. Insert the body message into variable like that:
Code:

<%
If Not objMsgs Is Nothing Then
     Select Case objMsgs.BodyFormat
             Case 0
                  messageMEM  = objMsgs.BodyText
                  messageMEM  = replace(messageMEM,VBCRLF,"<BR>")
             Case 1
                  messageMEM  = objMsgs.BodyText
             Case Else
                  messageMEM  = objMsgs.BodyText
     End Select
End If
messageMEM =  Replace(messageMEM, "'", "''")
%>

4. Then I try to enter the variable into my database, lets say like that:
INSERT INTO [MyData] (MailMessage) VALUES (MyVariable).
5. Almost all time it's working great and there is no problem except of one kind of email that give me this error:
Code:

Short Description:Unclosed quotation mark after the character string '  

as you can see I check the (') character, and replace him when I need.
6. After I check my code 100 times I found that when I'm gettint a message that end with this lines:
Code:

=00
------_=_NextPart_001_01C86738.6D29C986--

I'm getting this error.
7. When I'm remove manually this lines from the message I can enter her with no problem to the database.

Do you know something about it?


Thanks for any help you can give me.
Back to Top View noamway's Profile Search for other posts by noamway
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 05 February 2008 at 2:26am | IP Logged Quote Andrew

objMsgs.BodyText property decodes quoted-printable sequence "=00" to ASCII NULL (\0 or ASCIIZ). ASCII code of this character is 0. The SQL engine truncates string by ASCII NULL character, so the last part of string with ending quotation is missing. We suggest you to remove ASCII NULL characters from strings before storing them into the database:

Code:
messageMEM = Replace(messageMEM, Chr(0), "")


Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide