I am trying to send an html (MIME) email from xpages to my inbox which i open via lotus notes client (8.5.3). The email has greek text in the subject and body. Body text appears normally in greek but the subject text does not. In the past i have received emails with subject in greek without any problems. How can i change the encoding in my code?
Check these 2 links to see the email library i use:
http://www.bleedyellow.com/blogs/m.leusink/entry/send_html_mails_from_an_xpage_with_only_5_lines_of_code?lang=en_us
(link to older version of this library removed: latest version with a fix for this question can be found here)
You will need to modify the library to include following code for subject header:
mimeHeader = mimeRoot.createHeader("Subject");
mimeHeader.addValText(this._subject, "UTF-8");
PS: I suggest you report this to author, so it can be fixed.
Related
I'm trying to find the reason, why the email I sent via the Applications ->Configuration->Email Queue->Send email module converts all extended characters (like ěščř) to question marks. I have utf-8 and html format set in Email settings module for the website.
Please help.
I have to copy some text from a plain text file into Gmail's mail composer and make some parts of that text bold. I can obviously boldface those specific parts manually after pasting it to the composer. But is there a way to do this automatically such that when I copy that content to the Gmail composer those parts is already bold.
For example, here's the plain text to be copied to Gmail:
Breaking News: Elon Musk just invaded Mars.
I would normally copy this text to Gmail's composer and manually bolden the part Breaking news. But if the source would have been, say, MS Word file instead of a plain text file, Gmail would have boldfaced it for me.
Background: The reason I am looking for this is that the plain text file is an output of a simple Java program and I would just edit the Java program to give the necessary output that would handle boldfacing.
P.S: I have tried wrapping those parts with <b> tags like this:
<b>Breaking news </b>: Elon Musk just invaded Mars.
It didn't work. Gmail simply prints the tag itself with my content.
The Sending Email | Gmail API | Google Developers example may be used as the starting point with the addition, which is described below.
It is enough to prepare the message body (the value of the htmlBody variable) as the HTML document:
final MimeMessage message = new MimeMessage(session);
// From.
message.setFrom(...);
// To.
message.addRecipient(...);
// Subject.
message.setSubject(...);
// Body: HTML content.
message.setContent(htmlBody, "text/html");
Basic information on the HTML document formatting, in particular, on how to make a piece of text bold, please refer to HTML Text Formatting: see the <b> element.
I've created a html formatted email containing a table and want attachments to appear in rows in the table. I can't manage to get the attachments to appear in the body of the email at all, instead they come through (in our Lotus Notes 8.5.3 client) as attachments all grouped in the header under the attachment twistie.
Is there any way for the attachments to display in the body of the email instead of the header?
(Updated Jan 20, 2014)
For reference, I looked for sample methods for adding attachments. Mark Leusink here and Tony McGuckin here posted great snippets for building HTML/MIME emails, so I used these as a starting point, but couldn't find anything to get the attachment into the body. Stephan has clarified why that is in his response below.
Mime doesn't contain attachments in message bodies, so they won't show up. However with a little trickery you can get what you want:
add another attachment containing an icon to be shown for the attachment. One generic or one each
in your table construct a href followed by img src pointing to image and attachment
you can read more about the URL format here
http://en.m.wikipedia.org/wiki/MIME
Bonus track: there is a notes item to stop attachments to be shown (can recall which one) If you smuggle that in as header...
Stephan has already pointed you in the right direction, but I'll just add a bit more detail in case others stumble upon this question.
You need to create a multipart MIME structure -- specifically multipart/related -- containing an HTML part (Content-Type: text/html) and one or more attachment parts. Each attachment part should have a Content-ID header with a unique identifier.
Your HTML part will usually have at least one anchor element corresponding to each of the attachment parts. The href attribute can refer to the attachment by Content-ID. Here's an example:
someFile.ext
It's important the substring after "cid:" is an exact match of the Content-ID header of the corresponding attachment part. That's how the anchor and the attachment part are tied together.
As Stephan said, http://en.wikipedia.org/wiki/MIME is a good reference. However, the MHTML page (http://en.wikipedia.org/wiki/Mhtml) might be a better starting point. MHTML is a subset of MIME that focuses on multipart/related and HTML.
I'm trying to schedule a report and send the link via email to the recipients. But when I add a hyper link to the editor it takes it as a plain text. I'm using the following format:
Click Here
Does anyone know if this is even possible? If Cognos would take extra HTML attributes than the ones presented in the editor?
Try this out and make sure you drag HTML Item from toolbox
Send Mail
I have an application which reads the eml and convert it to NSF mails using C API. I am able to add HTML Body to it using NSFMimePartAppendStream method but my problem is how to add inline images to it.
By using method MailAddMessageAttachment attachment are getting added as normal attachment but how should map the Content id to it. Can any one please explain how to add inline images to mail body?
Regards,
HAseena
Issue is solved using MIME Content, reading the mime entirely with attachmenst and inline images "MIMEStreamWrite"