In VBA I’m currently using code similar to the following to create and send Outlook mail items:
Function example()
Dim OutAppl As Outlook.Application
Dim my_email As Outlook.MailItem
Set OutAppl = New Outlook.Application
Set my_email = OutAppl.CreateItem(olMailItem)
With my_email
.Importance = 2
.To = "me@foo.com; "
.Subject = "not so easy in C#"
.BodyFormat = 2 'olFormatHTML
.HTMLBody = "<P>" & _
"<BR>" & _
"<FONT face=""Lucida Sans Unicode"" size=2.5>" & _
"Hello SO" & _
"<BR>" & _
"</FONT>" & _
"</P>" & _
"</BODY></HTML>"
.Save
.send
End With
Set OutAppl = Nothing
Set my_email = Nothing
End Function
Where do I start in creating something like the above using C#?
Is there an outlook interops assemply that I can reference similar to using excel?
To answer your question directly, the Outlook Interop library is just a few down from Excels in Visual Studio’s
Add Referencedialogue box:And yes it works in the same way as Excels, you instantiate an Outlook Application object, and then more or less anything you can do through VBA in Outlook, you can do by calling the application instances equivalent method in .Net.
If you want me to add some sample code just comment and I will, but as jrummell says, why not just use
System.Net.Mail?