Jump to content
Xtreme .Net Talk

Recommended Posts

Guest double-helix
Posted

This needs a COM reference in order to work, so u will need Microsoft Outlook installed in order for this to work.

 

First, right click on the references tab, and choose Add reference. The, under the COM tab, choose Microsoft Outlook Object Model.

 

Then, at the top of the code, insert the key statement :

 

Imports Outlook

 

Add a command button to the form that you are working with, then name it cmdOutlookMail. Double click on it to display the code view, then insert the following code :

 

dim objectMail as new Outlook.Application()

dim objectItem as MailItem

objectItem = objectMail.CreateItem(OLitemType.olMailItem)

With objectItem

.Subject = "Visual Basic Forums Rock"

.To = "someidiot@williskool.com"

.CC = "anotheridiot@willisl337.com"

.Body = "Visit http://www.scripts-cs.tk"

.Attachments.add("C:\Autoexec.bat")

.Send()

End With

MsgBox("Mail Sent")

End Sub

'Note that cc, subject, body etc can all be replaced with other

'Things, even variables, etc:D

 

OK, thats it. get back to me for info :p

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...