CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2001
    Posts
    486

    Using VB to send Email with Outlook Express

    Am having little to no success trying to accomplish the subject.

    Have seen code here and on other sites that "appears" to work (i.e. I get no error messages, but I get no emails either).

    It occurred to me that all the code I have appears to be for Outlook and I am trying to use Outlook Express.

    Anyone know what the difference is and what I may need to include in my code specifically to indicate that I want to use Outlook Express?
    If kids were left to their own devices, would they ever come up with a thing like war?......The Wheel / Todd Rundgren

    Do canibals not eat clowns because they taste funny?

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

  3. #3
    Join Date
    Jan 2001
    Posts
    486
    Hey Wizbang, thanks for your reply. The code you referenced was one of many samples I have tried to no avail. I must admit to being a "babe in the woods" on this email thing, so please excuse my ignorance.

    With regard to your code sample, I made 2 assumptions, ran the code and got the following error:

    1) assumed UserName = "mysenderacct@hotmail.com"
    2) assumed UserMail = "myreceiveracct@hotmail.com" (different acct obviously)

    Error: Authoritative answer: Host not found


    So I guess I need to find out what to put here?
    Winsock1.RemoteHost = "smtp-server"

    ANY help you could provide is sincerely appreciated.
    If kids were left to their own devices, would they ever come up with a thing like war?......The Wheel / Todd Rundgren

    Do canibals not eat clowns because they taste funny?

  4. #4
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    I am not sure if you can find many examples that will use Outlook Express.

    In my understanding, Microsoft would prefer us to code for Outlook rather than Outlook Express. I looked myself for samples and couldn't locate any.

    In one of my apps, I gave the choice to the user to either use Outlook if it was detected on their system or use an smtp based routine to send email.
    I would like to add coding to use Netscape Messenger as well, but again, not many samples lying around...

    The only time that Outlook Express is invoked is when I use the ShellExecute command with a mailto address, which for some reason, starts up OE, even though it is not set as primary email client.

    Cheers,
    Laurent

  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Something to look at...

    Here: Mail with Outlook Express
    (code, but you will have italian comments...)
    http://www.it-lang-vb.net/download.a...lOE.zip&ID=597
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  6. #6
    Join Date
    Dec 2001
    Posts
    6,332
    doofusboy
    The "smtp-server" is replaced with the server you are going to use. So, in your case, that would be "mail.hotmail.com", or whatever it is.

  7. #7
    Join Date
    Jan 2001
    Posts
    486
    First off, I never cease to be amazed at how eager most people here are to help. Rekindles one's confidence in the human spirit.

    Two things:

    1) WizBang - I ashamedly admit I don't know how to determine my server in Outlook Express; poked around Tools, Options, etc. before my last post to you, but didn't see anything specifically labeled 'server'

    2) Cimperiali - thanks much for your efforts, but MOMMA MIA ! now I'm getting error messages in Italian - an awesome, romantic language, to be sure, but I'm having a tough time solving the messages in my native tongue!
    If kids were left to their own devices, would they ever come up with a thing like war?......The Wheel / Todd Rundgren

    Do canibals not eat clowns because they taste funny?

  8. #8
    Join Date
    Apr 2001
    Posts
    23

    Talking

    Here is the answer

    [Cimperiali: link added to the Faq of Vb. Thanks for sharing this code]
    Attached Files Attached Files
    Last edited by Cimperiali; August 19th, 2003 at 09:50 AM.

  9. #9
    Join Date
    Jan 2001
    Posts
    486

    Thumbs up

    ........and the winner is............johnpc7 !!!!!!!!!!!

    Dude, not only did that code work first time outta the box, it's unbelieveably clean and compact code!!!!!!

    Thanks VERY much for your help....you've no idea how much time I've spent trying to figure this out.

    The only thing left for me to do is figure out HOW your code is working......I've zero experience using MAPI and know nothing at all about it.
    If kids were left to their own devices, would they ever come up with a thing like war?......The Wheel / Todd Rundgren

    Do canibals not eat clowns because they taste funny?

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