D
double-helix
Guest
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
OK, thats it. get back to me for info
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
OK, thats it. get back to me for info