CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2001
    Location
    india
    Posts
    11

    how to generate emails using outlook express

    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


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: how to generate emails using outlook express

    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]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    78

    Re: how to generate emails using outlook express

    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)




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured