lotus notes javamail issue while reading body - apache-camel

Consider that I send the following text ["abc <20 spaces> b"], without the quotes, as body of an email to IBM lotus notes mailbox.
Now I've an apache camel IMAP mail component which reads that email. What I'm seeing is that after reading the email body, the text is wrapping to
abc
b
rather than "abc b", which is what I expect
Any clue will be helpful

It depends on how you create / read the mail. Square brackets in Notes mark so called "passthrough html". That means: everything inside the brackets will be rendered as html.
Your posted text will be converted to html. As <20 spaces> is not a valid html tag it is simply rendered as linebreak.

Related

Send multi-line signature to Metamask via web3js

Checked all the similar questions suggested and couldn't find an answer, unfortunately.
Is there a way to send a multi-line message to metamask via web3.eth.personal.sign as the first parameter? (The problem is how to get multiple lines, not how to actually send a message there)
A more eloquent example of my question can be seen in the image attached. There are multiple paragraphs on separate lines: 'Welcome to OpenSea!', 'Click "Sign" to sign in..." etc.
Thanks a lot!
You can either use \n or use instead of '' or "" when you send the message. The option with takes the spacing in the content into consideration (in js).

A Confusion about Raw query parameter

I am writing a simple migration tool in which I have to migrate gmail mailboxes to some other email provider. I am confused about raw string returned from gmail api.
In Google document, it says:
"raw": Returns the entire email message content in the raw field as a URL-safe base64 encoded string and the payload field is not used. This includes the identifiers, labels, metadata, MIME structure, and small body parts (typically less than 2KB).
So this means "raw" returns only small body parts less than 2kb and if the body parts are more than 2KB, there will be a problem. I have checked with some dummy emails containing email body(including inline attachments) more than 2KB, and it still works. It still returns the complete body without any problem. Sorry,if I missed something, please clear my confusion. If "raw" is working fine for all email body sizes , I will be using this approach in my project instead of "full" query parameter.
best regards,
messages.get(format=RAW) returns the entire email always. That document: https://developers.google.com/gmail/api/v1/reference/users/messages/get is incorrect and needs to be fixed.

cakephp2x email subject line length

I am trying to send an email using CakePHP 2x utility CakeEmail, I am getting all my values dynamically as below-
$Email = new CakeEmail();
$Email->from($from_id);
$Email->to($to_id);
$Email->subject($subject);
$Email->send($body);
Sometimes email is sending without any failure, but sometimes it wont. Finally I found the issue with the subject line length. Whenever my subject line is getting bigger then the email is not sending properly through programmatically. But, whenever my subject is line is less than nearly 75 characters then its working perfectly. So, how can I fix this issue by enlarging subject line length. Normally in gmail there is no restriction of subject length. But programmatically it is not allowing in CakePHP 2x CakeEmail utility.
Do you use SMTP. If not then please send mail using SMTP. and the check.
Please follow the given link bellow.
http://book.cakephp.org/2.0/en/core-utility-libraries/email.html
Got the solution by myself. Simply change the core behavior of Email functionality in Cake Lib. Open \lib\Cake\Network\Email\MailTransport.php and edit line no - 47 as below
$this->_mail($to, str_replace(array("\r","\n"), "", $email->subject()), $message, $headers, $params);
So, the basic change is to remove "New Line" & "Carriage Return" from Subject text. Whenever our subject text becomes more than 75 characters, framework will automatically put new line in the subject text, which wont work while on sending emails.

Get original content type from multipart/alternative

I'm using javamail 1.4.7 to read mail from Gmail with imap.
I'm getting MimeType multipart/alternative even though my content is simple plain text (e.g "hello world").
I got 2 body parts, one having content type text/plain other has text/html.
My question is how can I determine which body part is oroginal(originally sent by sender).
I just want to fetch mail with it's original content type (i.e If mail content is plain text then I want to fetch part having content type "text/plain" and if mail content having html then I want to fetch part having content type "text/html").
How do you know your mailer isn't sending your simple plain text message as multipart/alternative?
If your mailer isn't sending both parts, then some mail server is converting the original body to multipart/alternative. There's no defined way to know whether or how it did that.

Saving new Lines in database and Json

I have this problem:
I have an HTML textarea which is filled by the user. (And he can press The enter button to go on a new line).
Then I take The value of The textarea using the command:
document.getElementById("textareaCommento")
And I pass The value to the servlet using an XmlHttpRequest.
In The servlet I save this value in a database.
Since this point I have no problems...
Then, in another part I want to get The values from The database. Using a servlet I make this query
Select * from comments
And I transform the results in json. Here I have The problem... The newline character makes my JSON string invalid. For example:
"Comment":"hello
Word"
How can I do?
Thanks in advance!
You have to replace the \n character from database to something like <br/>
For the replace see replace \n and \r\n with <br /> in java
this CSS worked for me,
white-space: pre-line;
You should be able to url encode your values so hello world would actually become "hello%20world", to do it in java see here:
Encoding URL query parameters in Java
To do it in javascript see here:
Encode URL in JavaScript?

Resources