Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

visual studio to send html email

Posted on 2011-02-23
1
Medium Priority
?
794 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

610 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