Hey guys,

I have recently programmed a site that enables a user to upload and download files to and from an FTP site.

I now wish to take it further by having an email sent out to a specific email account (Outlook 2010) confirming that a file has been uploaded or downloaded along with the file name.

I have added the 'Microsoft Outlook 14.0 reference.

I have also created an Outlook Application as follows:

Dim oApp = New Outlook.Application()

When I go to then declare a MailItem variable, I dont get it in the list, all I get to select is 'Application':

Dim oMsg As Outlook.

How do I go about setting up a MailItem variable?

Can anybody help please?



In addition to adding the reference to Microsoft Outlook 14, make sure that you also import the namespace Microsoft.Office.Interop.

Then you can use this code to create a mail message.

Dim oApp As New Outlook.Application()
Dim oMsg As Outlook.MailItem

oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
oMsg.To = "reciever@domain.com"
oMsg.Subject = "mail subject"
oMsg.Body = "simple mail body text"
'' OR
'oMsg.HTMLBody = "html mail body text"


'Optionally also use:

Edited 5 Years Ago by Oxiegen: n/a



Thank you for your post.

I got it working :-)

Thank you very much.


This question has already been answered. Start a new discussion instead.