I using vb.net code to send emails. There is no problem in sending plain text emails but I want to use some formating (bold, coloured text et.) I am writing my message body in a richtextbox but do not know how to do the formatting.
Also I want to insert picture. Please help regarding that too.
Thank you very much.
You basically need to make a html file with css for the elements you want to be colored. This you add to your email as an attachment with mime-type set to text/html.
For images you add these as base64 encoded attachments and use their Content-ID as CID: reference in your html code.
I wrote a little more about this in my answer to this thread:
Send email includes image like Outlook does?
Related
In Outlook, my e-mails are displayed as plain text due to e-mail security gorup policies. I have to activate html view via the menu above the mail content each time when I open the e-mail.
Is there a simple VBA code that automatically changes the view from text to html, when opening the e-mail?
Any help will be highly appreciated.
The MailItem.BodyFormat property returns or sets an OlBodyFormat constant indicating the format of the body text.
'Set body format to HTML
MailItem.BodyFormat = olFormatHTML
I believe we are talking about viewing messages, not creating messages.
What about when MailItem.BodyFormat = olFormatHTML doesn't work?
Our IT sets previews and message views to Plain Text, but allows selecting "We converted this message into plain text" and clicking "Display as HTML".
I need to rollout an Outlook VBA macro to disable and display all hyperlinks in email messages.
Optimally all hyperlinks would be disabled from being clickable and for text that have a “hidden” link the link would be disabled and following the text (still in blue) the link would be displayed within square brackets.
I have a lot of Excel VBA experience but almost no Outlook VBA experience. I’m surprised this code isn’t all over the place but after a week of searching I’ve found nothing.
You would need to retrieve the HTML body (MailItem.HTMLBody property), load it into an instance of the IHTMLDocument2 object, loop thorough the links collection and modify the links. You will then need to retrieve the modified HTML body and set the MailItem.HTMLBody property.
You can of course do your own parsing by looking at all the <a> tags in the HTML body instead of using the IHTMLDocument2 object.
When I take a snippet or screenshot of something I'm working on and need to send it in an e-mail (MS Outlook), I don't always want to paste it in-line in the HTML body of the e-mail. There are times where I would like to add the image as an attachment.
In the interest of making this repetitive task a bit more efficient, is it possible for me to accomplish this without having to first save the image/screenshot and add an attachment manually? Perhaps a macro to convert an in-line image in my e-mail to an attachment on the same e-mail?
Downloading add-ons or plugin-ins is a no go; I work in a large corporate environment where this is near impossible to do.
Thank you!
What exactly do you mean by inline images? Images hosted on the remote HTTP servers and referenced by the HTML body? Or embedded image attachment referenced by the HTML body by their cid's? In the latter case, the attachments are already in the MailItem.Attachments collection.
You cannot simply convert an inline (embedded image) image into an attachment, you will need to save the inline attachment to a folder location, delete the inline attachment, and reattach the saved attachment.
I want to create a document from an existing Word 2010 document and convert it to PDF using docx4j 3.1.0. I've built upon the sample in
https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutPDF.java
The Word document already contains a header with text and an image that I do not modify in my processing. The resulting PDF document, however, doesn't contain the header.
Is this someting that is supposed to work? If yes: how can I find out what I am missing?
Yes, if you can see the header when you "save as PDF" in Word, then you should also see the header in docx4j's PDF output.
To have it fixed, we'll need to see the docx.
Just for the curious reader: the specific cause for the missing header turned out to be a wrong approach of setting page margins on the document. Instead of modifiying the existing settings via body.getSectPr().getPgMar() (or even simpler: setting it in the template right away), the code created new PageDimensions and set a new SectPtr on the body, thereby somehow overwriting or removing the header.
I have a form that uses Richtexteditor of Flex3 to write in their reply. The reply is then posted to a textarea, where all of the formatting is lost! I have embedded the font since I was doing some tweeening on the text boxes.
I need to find out how keep the formatting intact in the textarea from richtexteditor!
has anybody an idea?
Make sure that you set the htmlText property on the TextArea, not just text.