aspose file tools
The moose likes Java in General and the fly likes javamail + mysql = wrong insertion of an apostrophe Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "javamail + mysql = wrong insertion of an apostrophe" Watch "javamail + mysql = wrong insertion of an apostrophe" New topic
Author

javamail + mysql = wrong insertion of an apostrophe

Rodrigo Bossini
Ranch Hand

Joined: Jul 03, 2009
Posts: 106
Hi,

I'm using javamail API to download emails from an email inbox. ONce downloaded, my app inserts the message field from the email to a table in mysql.

This message is a simple text. There are no email signatures nor attachements. The message is inserted completely to the table, but it also inserts an apostrophe with the message.

Has anyone seen this problem before? What could possibly cause such a problem?


I see wind mills
Matt Cartwright
Ranch Hand

Joined: Aug 25, 2008
Posts: 149

is this around the add-spec address (e.g. Matt.Cartwright@space.aero)?
or around the recipients name (e.g. Matt Cartwright)?

If it's the latter case, you might be using non-atom (RFC2822) characters
in your recipient's name.

If it is addr-spec, your are talking to some legacy SMTP implementation.

All doesn't sound like a Java problem, rather SMTP.

Would you have some code you can post?

Together with its output?

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Matt Cartwright wrote:Together with it'sits output?
Matt Cartwright
Ranch Hand

Joined: Aug 25, 2008
Posts: 149

point taken
Rodrigo Bossini
Ranch Hand

Joined: Jul 03, 2009
Posts: 106
Thanks for replying.

I verified the problem more deeply.

Actually, my application was inserting a double quotes (instead of an apostrophe) mistakenly in the destinatary field (instead of in the message field).

And I found out what the problem was.

Say you are using outlook to send emails, and you add your usual emails as contacts.

When you send a new email to that contact, the destinatary field is formatted like the following:

"yourcontactEmailAdress@domain.com" <yourcontactEmailAdress@domain.com>

There is the problem. My application was prepared to dealing with <yourcontactEmailAdress@domain.com> but not with "yourcontactEmailAdress@domain.com".

Thank you all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javamail + mysql = wrong insertion of an apostrophe
 
Similar Threads
problem while inserting the record in db using mySQL
MySQL will only accept the first 256 inserts?
Locking on multiple simultaneous inserts
Catching invalid email Id exception
How do i store a folder of emails locally?