Results 1 to 9 of 9

Thread: Problem sending Emails *resolved*

  1. #1

    Thread Starter
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Resolved Problem sending Emails *resolved*

    Hi All,

    I wrote an application that I want to run on as a scheduled task on another computer in the office. It creates an HTML body Email and sends it via Outlook 2002. It runs fine on my machine but when I run it from the other MicroSoft Publisher keeps popping up like I'm trying to send a picture. I still get the Emails being sent to me from it. It sends around 100 Emails a run and I end up having to stop it and close all the publishing windows. I compared my Outlook settings to the other computer and I don't see any differences. Any suggestions?

    This is NOT some spam mechinism I'm playing with here. We are a third party Doctor scheduling firm and these Emails are going to our Doctors with appointment notifications.

    Here is the code that sends the Email:

    VB Code:
    1. Dim olApp As Outlook.Application
    2.      Set olApp = CreateObject("Outlook.Application")
    3.  
    4.      Dim olNS As Outlook.NameSpace
    5.      Set olNS = olApp.GetNamespace("MAPI")
    6.      olNS.Logon
    7.  
    8.      Dim olMail As Outlook.MailItem
    9.      Set olMail = olApp.CreateItem(olMailItem)
    10.  
    11.      If iFollowUpMethod = 1 Then
    12.          sTo = sEmail
    13.      Else
    14.          sTo = sFax
    15.      End If
    16.          
    17.      sTo = "[email protected]"
    18.      olMail.To = sTo
    19.      olMail.Subject = "XXXXXX - Patient Follow-ups for: " & Format(dCurrentDate, "MM/DD/YYYY")
    20.      olMail.HTMLBody = sBody
    21.      olMail.Send
    22.  
    23.      olNS.Logoff
    24.      Set olNS = Nothing
    25.      Set olMail = Nothing
    26.      Set olApp = Nothing
    Last edited by TysonLPrice; Feb 16th, 2005 at 07:31 AM.

  2. #2

    Thread Starter
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Problem sending Emails

    This just keeps getting weirder. In a subsequent test ADOBE reader kept popping up with the same document over and over. After I clicked it shut about a dozen times the program started running the way it should. That is a message pops up saying a program is trying to send an Email and do I want to allow it. Unless someone can point me in another direction I thinking it must be the ClickYes.exe I'm using so no human response is necessary to send the Email. I got it from here:

    http://www.contextmagic.com/express-clickyes

    Maybe it's clicking yes to something I can't see. Anybody else used this? I've seen it as a solution many times to the Outlook prompt.

    I'm thinking I need to find another way to send Emails other then through Outlook 2002.

    Any suggestions?

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177

    Re: Problem sending Emails

    I have an app that runs continuously and sends out pager notifications when an unusual event occurs. I originally coded it to use Outlook. After some time, I began getting the popups. I then tried using MAPI, but had a similar result (the message was different - something about app accessing my address book). I wound up using the SMTP protocol to get around the popups.

    I'm attaching the little test app that I wrote to work out the details. There are some comments at the end of lines where you will have to fill in your own information.
    Attached Files Attached Files

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem sending Emails

    The popup is the Outlook Security Warning message. To get around it and still use Outlook you need to
    write an Add-In and use the trusted application object that is passed in the parameters for the OnConnection event in
    the designer module.

    Otherwise use SMTP like previously suggested.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Problem sending Emails

    Thanks for the responses. I ended up playing around with vbSendMail and it was pretty easy to set up. From what I've read and the couple of tests I did it should work fine for my purposes. The reveiws were pretty good. You can learn about it and get it from here:

    http://www.freevbcode.com/ShowCode.Asp?ID=109

    I didn't like having that ClickYes.exe on there anyway.

    Thanks for the code example ccoder. I tucked it away in my tools.

    Last edited by TysonLPrice; Feb 9th, 2005 at 08:49 AM.

  6. #6
    New Member
    Join Date
    Nov 2004
    Posts
    8

    Re: Problem sending Emails

    Did it help in avoiding the security warning messages?

  7. #7

    Thread Starter
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Problem sending Emails

    Quote Originally Posted by Rishi1022
    Did it help in avoiding the security warning messages?
    Been out of town. Yes it does not use Outlook.

  8. #8
    New Member
    Join Date
    Nov 2004
    Posts
    8

    Re: Problem sending Emails *resolved*

    So using this VBsendmail.dll, shall we read and send e-mails from outlook without getting the warning messages?

  9. #9

    Thread Starter
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Problem sending Emails *resolved*

    Quote Originally Posted by Rishi1022
    So using this VBsendmail.dll, shall we read and send e-mails from outlook without getting the warning messages?
    I guess I misunderstood your question. Outlook is not being used so it is not generating any warning messages. After the DLL is added the coding is just:

    VB Code:
    1. Set poSendMail = New clsSendMail
    2. With poSendMail
    3.         .SMTPHost = "Mail.yourdomain.com"
    4.         .From = "[email protected]"
    5.         .FromDisplayName = "The Widget Corporation"
    6.         .AsHTML = True
    7.         .Message = sBody
    8.         .Recipient = sTo
    9.         .Subject = "The WidgetCorporation - Patient Follow-ups for: " & Format(dCurrentDate, "MM/DD/YYYY")
    10.         .Send
    11.     End With

    sBody and sTo are just strings I populated.

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