0

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?

Thanks,

Dan

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by dwinn
1

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"

oMsg.Send()

'Optionally also use:
'oMsg.Display()

Edited by Oxiegen: n/a

Votes + Comments
agree
0

Hi,

Thank you for your post.

I got it working :-)

Thank you very much.

Dan

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.