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:
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olNS As Outlook.NameSpace
Set olNS = olApp.GetNamespace("MAPI")
olNS.Logon
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
If iFollowUpMethod = 1 Then
sTo = sEmail
Else
sTo = sFax
End If
olMail.To = sTo
olMail.Subject = "XXXXXX - Patient Follow-ups for: " & Format(dCurrentDate, "MM/DD/YYYY")
olMail.HTMLBody = sBody
olMail.Send
olNS.Logoff
Set olNS = Nothing
Set olMail = Nothing
Set olApp = Nothing
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?
1 Attachment(s)
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.
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.
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.
:wave:
Re: Problem sending Emails
Did it help in avoiding the security warning messages?
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.
Re: Problem sending Emails *resolved*
So using this VBsendmail.dll, shall we read and send e-mails from outlook without getting the warning messages?
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:
Set poSendMail = New clsSendMail
With poSendMail
.SMTPHost = "Mail.yourdomain.com"
.FromDisplayName = "The Widget Corporation"
.AsHTML = True
.Message = sBody
.Recipient = sTo
.Subject = "The WidgetCorporation - Patient Follow-ups for: " & Format(dCurrentDate, "MM/DD/YYYY")
.Send
End With
sBody and sTo are just strings I populated.