954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Sending an email once file been uploaded/downloaded

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

dwinn
Junior Poster in Training
53 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

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()
Oxiegen
Master Poster
715 posts since Jun 2006
Reputation Points: 87
Solved Threads: 141
 

Hi,

Thank you for your post.

I got it working :-)

Thank you very much.

Dan

dwinn
Junior Poster in Training
53 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: