How do i send pre formatted Emails using VB.NET - html

How can i send formatted Emails using VB.NET.
I have a Document (MS WORD 2007) which contains text and images
i need to send the contents as an email.
i am able to read the content and place it in the clipboard, however the only functions available with Clipboard class are limiting me to only retrieve the text of the document.
can anyone help?

You can send email in HTML format, create an HTML file from word, and set it as the body of the Email message. Make sure IsBodyHtml property is set to true.

Related

Mailto Hyperlink Limitations?

I am attempting to create a VBA Macro that will automatically send emails based on attributes within my spreadsheet - within each email is HTML code with <a href ="mailto:...> hyperlinks. The cc and bcc fields in those hyperlinks are dynamic as well.
I create the HTML code for the hyperlinks within the excel spreadsheet itself by using Concatenate to create the following values:
send email
In order to test that it works, I display the olmailitem before sending. All of my hyperlinks work perfectly when the olmailitem is displayed. However, when I send the email to myself to test it from my Outlook, one of the hyperlinks fails to open. There is no error message - it just does not open.
The one difference between the mailto hyperlink that does not work and the others is that there are around 70 emails that are BCC'ed in the html. The length of this mailto hyperlink is 1683 characters.
I think that my issue is that there is a maximum length to a URL that outlook can handle from its desktop application. However, I don't know what that length is. Does anyone have insight?

UiPath integration with Linkedin - Html characters not preserving formatting

We have an RPA on a site, to post a form. In the form we want to send HTML content with formatting. But the site is removing all the formatting, and is just showing html characters as is (like a text). But when we are copy pasting the content from tinymce editor (at our end) to the same site's form it is showing the content properly with formatting.
What needs to be done from my end while sending data to UiPath so that it puts the content in proper html format with formatting preserved?
I also tried sending html codes encoded by gson which is done by default. That also did not work.
This is when we are copy pasting the content -
And this is when we are sending data via uipath -
EDIT
This is what the uipath activity looks like (The description is being sent by an http api which uipath calls to get data) -
Thanks
Better use the Assign activity:
In the String variable website you simply save the HTML page. Now you can easily paste the variable anywhere. Also you don't need to paste the HTML in your editor via CTRL+V.
Just use the Type into activity:

How tell Outlook where image files are?

Please bear with me; there's a long story coming up. It's about programatically creating HTML e-mails from Delphi-7, sending them to Outlook, and not showing the pictures in it, so if you don't know anything about that, don't bother reading it all.
I have an application that sends variable-text E-mails, from a Delphi-7 program, to Outlook. I'm using a TMailInfo item, use a template HTML file for layout, replace placeholders with data from the program (%NAME% becomes "Johnson" etc), create a new Outlook message and populate HTMLbody with my result. All of this works fine.
Recently my client sent me a new sample message, asking me if I could change this E-mail to the new layout as he sent me. So I saved the E-mail as html (from Outlook, generating a huge HTML file full of code that is hardly understandable for a non-HTML guru like me)), replaced the static data with my placeholders, and saved it as the new template.
This worked fine except for one thing - the new layout included some local pictures (not available from a public web resource). When original sample mail from outlook, two things were created - a htm file with the html code, named "Subject" AND a folder called "Subject_files", containing the picture files plus a filelist.xml and an mso file.
The generated HTML refers to the pictures as src="subject_files/image001.jpg"> etc.
When I send the HTML to Outlook, it obviously has no idea where the images are - but how do I tell him?
What I tried:
copying the "subject_files" folder to "My Documents"
hardcoding the links to the pictures in several formats (i.e.
src="C:/test/subject_files/image001.jpg",
src="C://test/subject_files/image001.jpg",
src="C:\test\subject_files\image001.jpg",
and the like
but both don't work... so my question is really, how do I tell Outlook where to look for image files when programatically creating an HTML message?
Thanks in advance!
Once you the email, the recipient does not have access to your computer, So the images won't show in the email. to send images in an email you can:
Use aboslute links
<img src="http://www.example.com/images/header.jpg">
Use embedded images
Convert your images to BASE64, you can find many web sites online to that like
https://www.base64-image.de/ then
<img src="data:image/jpg;base64,/*base64-generated-string*/" />
As mentioned by Remy, the images can be added as regular attachments. You will then need to set the PR_ATTACH_CONTENT_ID property (DASL name http://schemas.microsoft.com/mapi/proptag/0x3712001F) using Attachment.PropertyAccessor.SetProperty. The HTML body must use the matching value for the cid attribute - <img src="cid:xyz">, where "xyz" is the value of the PR_ATTACH_CONTENT_ID property.

Saving text as HTML from form

I have a form with a text field that users input text into. They can use multiple lines, put in bold text, underlined text, etc., but the text, when saved to SQL Server doesn't have any formatting saved, just the text is saved. What is the best way to save the text with the HTML so that when it gets viewed by another user and pulled up from Sql Server the HTML is saved and the formatting is saved?
Ex.
hello
Paul
This would be saved as
helloPaul
you can't see it but there are bold and carriage return html tags rapped around the text
When receiving data from the user, on the server side code, use HTML encode to safely store the data:
var inputData = Server.HtmlEncode("<strong>some data input from user</strong>"); //insert your user input data variable here
Then when displaying the data in your cshtml page, decode the data to display it as the user entered it:
HttpUtility.HtmlDecode(saveUserDataFromDatabaseVariable);
All this is assuming you have a rich text editor being plugged into the input field. CKEditor and TinyMCE are good ones.
You can use a text editor. Take a look at CKEditor. It's free and easy to use :)
Can you post some code and more details?
I have had good success with CKEditor. It is customizable, and its content can easily be saved via postback to a standard asp:TextBox.
It is possible that the editor you are using is not actually updating the input/textarea that you are using, it may be cloning the text and drawing the formatting in an overlay. You can use developer tools, or javascript, to verify this by checking the value property of the input or textarea element. If it is being saved via AJAX or javascript the code may be using the textContent or innerText properties instead of innerHTML.
I used the richtexteditor dll that's free online. it gave me a wiziwig box that the user can edit texxt in.

Pasting formatted text from HTML into MS Access memo form field

I have a super simple MS Access form with two fields to collect some data quickly, one of which is a memo data type, wired into a table field. I want to copy some formatted text from HTML into it and would like to preserve the formatting (bolding, fonts, italic, etc.). However, when I do Ctrl-C --> Ctrl-V, it only pastes unformatted plain text.
Is there any way I can configure my form field to accept and save formatted text? If I paste the same into MS Word, the formatting IS preserved.
You will have to open the 'source' of the HTML file, and only then copy+paste.
From the browser, you'll just see the HTML output.. and some apps, like Notepad, won't be able to store the data through a simple copy+paste. MS Word can do it, as you might already know, since it is a rich-text editor.
As for a field in MS Access, you can only preserve the formatting if you copy the source itself. It will help if you let us know which browser you are copying from, though normally, there is an option to view the source code of the page being viewed.
[edit:in response to comment]
If you want rich text to enter into an ms access field, try the first few steps here: http://office.microsoft.com/en-001/access-help/insert-or-add-a-rich-text-field-HA010014097.aspx