locked
vb.net and outlook 2007 RRS feed

  • Question

  • hi i am trying to create either a console app or windows app, that will allow me to send an email once a week to a specific recipient. i will use scheduler to run the program which should be fully automated and pop up with a message saying success. having done lots of reading and tried lots of different code i am going round in circles. to send email normally i use outlook 2007 and it is set to connect to an https email adress which goes through to an exchange server.

    I have tried the smtp client method but that fails telling me that the server cant be found, i have had a look at mapi, but it seems that there is no MAPIsession available if got to add references the only thing i can find is outlook itself, whixh if i type mapi, comes up with mapifolder????

    If anyone has any ideas or any sample code it would be much appreciated. normally when i load outlook it comes straight up with a login box and i have to put my credentials in.

    • Moved by Alex Liang Friday, July 23, 2010 4:39 AM Ridirect to a more related forum for better response (From:Visual Basic General)
    Wednesday, July 21, 2010 9:46 AM

Answers

All replies

  • i use this code

    Dim application As New outlook.Application

            Dim mynamespace As outlook.NameSpace

            mynamespace = application.GetNamespace("MAPI")
            mynamespace.Logon("outlook", "", True, True)

    which works to the point of loading the login box to the exchange server, how can i get it to fill in the credentials for me?

     

    Wednesday, July 21, 2010 11:09 AM
  • "mataston" wrote in message news:3cc7dbd6-5a10-40b0-8594-972fec117ada...

    i use this code

    Dim application As New outlook.Application

            Dim mynamespace As outlook.NameSpace

            mynamespace = application.GetNamespace("MAPI")
            mynamespace.Logon("outlook", "", True, True)

    which works to the point of loading the login box to the exchange server, how can i get it to fill in the credentials for me?

     

    My suggestion is to get away from Outlook altogether for this task. Google Benet and sending email. There are thousands of good examples.


    Harry
    • Edited by Sue Mosher Saturday, July 24, 2010 7:25 PM move </blockquote> to make response easier to read
    Thursday, July 22, 2010 8:26 PM
  • i have to use outlook as the email i am trying to send has to go through my company email, as it is picked up by another system within the company.

    all that is needed in my email is a few words to say whether something i have tested has passed or failed, with sits in the subject line.

    i have code for creating the email that works fine. it does send the email except i have to login first. i want to try and work around the login bit somehow

    Thursday, July 22, 2010 10:12 PM
  • Outlook is not suitable to automate from the scheduler; the considerations discussed at http://support.microsoft.com/?id=257757 apply. You can, however, use the third-party Outlook Redemption library.

    Another managed code approach would be to use System.Net.Mail. The site at http://www.systemnetmail.com/ is a great resource for this .NET class. You will, of course, need the SMTP credentials for the server. 

    Given that you're using an Exchange server, you might want to look at the options available for the Exchange server itself, which will vary with the server version. Documentation starts at http://msdn.microsoft.com/exchange/ with discussions at http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads. There might even be a discussion already going around your issue.

    • Proposed as answer by Sue Mosher Wednesday, August 4, 2010 1:15 PM
    • Marked as answer by Sue Mosher Sunday, August 15, 2010 10:28 PM
    Friday, July 23, 2010 12:16 PM