i want to genearte emails using outlook express object plz send me the codes and the libraries which i need to have along with the screen design as iam new to vb
Printable View
i want to genearte emails using outlook express object plz send me the codes and the libraries which i need to have along with the screen design as iam new to vb
add the Outlook Type library to the references of your project
Dim MyApp as Outlook.Application
Dim MyMailItem as Outlook.MailItem
set MyApp = new Outlook.Application
set MyMailItem = MyApp.CreateObject(olMailItem)
MyMailItem.Recipients.Add ("[email protected]") ' replace with a real address
'it can be '.To = "[email protected]"
MyMailItem.Subject = "Test" ' Subject field of the email
MyMailItem.Body = "This is just a Test!!!" ' main body of the email
'or for HTML report
'.HTMLBody = GetReport 'gets the report and puts into HTML
MyMailItem.CC = "[email protected]" ' replace with a real address
'.Importance = olImportanceNormal
MyMailItem.Send () ' send the message
'Close Outlook
Set MyApp = Nothing
Set MyMailItem = Nothing
'To send to recipients in thyour Address book
Recipients.Add "Joe Smith"), if "Joe Smith" is in your address book, & Outlook will find the right email address
for you.
Iouri Boutchkine
[email protected]
I tried your code for Outlook 2000 and it failed at the line:
set MyMailItem = MyApp.CreateObject(olMailItem)
it works with the following line tho:
set MyMailItem = MyApp.CreateItem(olMailItem)