Solved

visual studio to send html email

Posted on 2011-02-23
1
789 Views
Last Modified: 2012-05-11
I have a visual basic application that generates a report in html format.  So far, so good.

Now I want the user to have the option to email the page.  I am using a linklabel.

Two things:
--When I use the full html, I get an error "Cannot start Microsoft Office Outlook.  The command line argument is not valid.  Verify the switch you are using."
--When I scale back the html to a very simple page, Outlook opens the right way, but the html is printed out rather than displaying like a webpage.

Am I trying something that cannot be done?
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Dim HTML As String = My.Computer.FileSystem.ReadAllText(MyTmp & "\Daily.html")
        Process.Start("mailto:anyone@somewhere.com?subject=test&content-type=text/html&body=" & HTML)
    End Sub

Open in new window

0
Comment
Question by:motokent
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
motokent earned 0 total points
ID: 34965582
I found the answer here:
http://www.techrepublic.com/article/easily-automate-microsoft-outlook-via-net/5850937

Dim app As Microsoft.Office.Interop.Outlook.Application
Dim appNameSpace As Microsoft.Office.Interop.Outlook._NameSpace
Dim memo As Microsoft.Office.Interop.Outlook.MailItem
Dim outbox As Microsoft.Office.Interop.Outlook.MAPIFolder
Try
app = New Microsoft.Office.Interop.Outlook.ApplicationappNameSpace = app.GetNamespace("MAPI")appNameSpace.Logon(Nothing, Nothing, False, False)
memo = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)memo.To = "Anthony.Patton@Ingenix.com" memo.Subject = "TechRepublic.com Test"memo.Body = "Hello there"memo.Send()
Catch ex As COMExceptionConsole.WriteLine(ex.ToString())
End Try

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question