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.
Related
I have a submit only XPage based form that has an inputRichText field for storing screenshots and a multi file upload (using the XPages Multiple File Uploader from OpenNTF) for uploading one or more attachments. When submitted I need both the screenshots and the attachments to appear in a single rich text field which will be accessed via the Notes Client only (non XPages).
Currently the form stores the attachments and screenshots in separate fields. I have tried appending one field to the other on save (using SSJS in the submit button, however because the Screenshots are stored as MIME and the attachments as NotesRichText, it is not letting me do it.
Is there some way (preferably in SSJS) that I can convert either the MIME to RichText or vice versa so that I can append one field to the other? I have tried searching for various solutions to no avail, as well as trying different file upload controls from OpenNTF.
Ideally I need something like this to work:
var rtItemAttachments:NotesRichTextItem = docTo_Backend.getFirstItem("attachments"); //This is the field I want everything in
var rtItemFiles:NotesRichTextItem = docTo_Backend.getFirstItem("uploadedFiles");
rtItemAttachments.appendRTItem(rtItemFiles); //Fails on this line
docTo_Backend.removeItem("uploadedFiles");
Speak after me: there is no RichText in the web, all there is is MIME.
You can set the RT field to store its content in MIME (a property). This makes things much easier.
To stitch things together you need to stick with MIME. These are roughly the steps
Get the text and images as MIME
Get your attachments as stream (the embeddedObjects has a method for that)
Convert the stream to BASE64 and create a new mime-part with it. (Looking at an attachment eMail source someone sent through the internet should give you a pretty good idea how it looks like)
You end up with:
MimeHeader
MimePart for Text (HTML)
MimePart for Screenshots (if they are not inline images in html)
MimeParts for attachments
The special effect: if you add to the HTML with links to the attachments, it looks nicer.
Of course the BIG question: WHY?
You could simply design a Notes form that has two fields, no need to fold it into one. Hope that helps.
A good piece of code to look at to understand the MIME stuff is the OpenNTF eMail bean
Given asciidoctor file my-document.adoc with the content:
include::included-document.adoc[]
included-document.adoc contains
The content of this file cannot be changed.
This text *has to be replaced*.
When I render my-document.adoc, I want to have the visible content
The content of this file cannot be changed.
This text has successfully been replaced.
Is this possible without changing included-document.adoc? my-document.adoc may be changed.
There is an Asciidoctor extension lab that provides examples for this, for example an include processor that exchanges tabs for spaces.
I hope this gets you started.
https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/whitespace-include-processor.rb
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.
If I'm using an anchor for signer initials, and I want it to appear on every single page. Can I do this with DocuSign using an HTML document?
It's easier for us to create and maintain HTML templates to add to envelopes than it is Word docs or PDFs. However none of the methods of trying to get an HTML repeating footer (the footer prints on every page) seem to work. Is it possible?
DocuSign will accept a wide variety of document types, but upon import into the DocuSign system, all documents are converted to PDF format. So, while it's feasible to supply an HTML file to DocuSign, don't expect DocuSign to interpret/process any of the HTML code that your HTML file contains, because as soon as it's imported into DocuSign it's no longer an HTML file -- it's just plain text.
So, if you want to use anchor text for placement of signer initials at the bottom of each page, then the document you upload to DocuSign (regardless of file format) will need to explicitly contain that anchor text string at the bottom of each page.
I have an input Excel file that I get that's provided to me by a third party. This list just includes names, phone numbers, and email addresses. I'm trying to convert the file from Excel into wiki format. My train of thought so far uses 'xlhtml' to get it into text. I can then use pandoc -f html -t mediawiki emp2.txt -o emp3.txt to convert it to wiki markup. The issue is that pandoc doesn't translate the html tables that were created in the first step.
Alternatively, I can use basic sed, grep, awk, etc to strip out html tags that will always be the same making my job easy, but then I have the issue of taking plain text user#domain.com email addresses and turning them into [mailto:user#domain.com] which I also don't know how to do. I'm not which route is best to take. This is not to be a portable solution, so I can use python, perl, php, bash, or any other CLI based utilities.
An alternative route could be to export the Excel doc to csv first and then manipulate it.
A note when using xlhtml that may help, email addresses are formatted as links in Excel, so xlhtml outputs them using <a href= links which are the ones I want converted to [mailto:user#domain.com]
so you get <a href="user#domain.com"> and you want it to be [mailto:user#domain.com]?
Since everything else is names and phone numbers, why don't you just use any text edit program and do a simple find and replace <a href=" to [mailto: and "> to ]