Outlook 2003 - A program is trying to access e-mail addresses

D

Daniel

I want to get an email when a new post is posted and I got that to work but I keep getting "A program is trying to access e-mail addresses" dialog box and I have to keep pressing Yes for it to send the email. Is there away to get around that?

Just so you know the "Show number of unread items" in properties is grayed out.
..
Submitted using http://www.outlookforums.com
 
D

Daniel

After reading that page I changed my code to this:

Sub Mail()
If Item.Userproperties("ID") = "" Then
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "New Post in HelpDesk Folder"
objMessage.From = "HelpDesk@*********.com"
objMessage.To = "*******@**********.com"
objMessage.TextBody = "There's a new Post in the HelpDesk Folder"
objMessage.Send <--- I get the error on this line.
End IF
End Sub

But when I try to send I get this error:

The SendUsing configuration value is invalid.

I'm using outlook vbscript..
Submitted using http://www.outlookforums.com
 
S

Sue Mosher [MVP]

That code assumes that you have an SMTP server running on your own machine.
If you want to send through a remote SMTP server, you need to add other
code, as described in the article at http://www.paulsadowski.com/WSH/cdo.htm
under the sections "Sending a text email using a remote server" and "Sending
a text email using authentication against a remote SMTP server."

It might be possible to modify your original code to work without trigging
security prompts, but since we don't know what that code was, that's only
speculation.
 
D

Daniel

Here's the original code:

Sub Mail()
Dim objOutlook
Dim objOutlookMsg

If Item.Userproperties("ID") = "" Then
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)

With objOutlookMsg
.To = "mailto:[email protected]"
.Subject = "New Post in HelpDesk"
.Send
End With

Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End IF
End Sub

I had to scrap this because when I tried it on another computer that has outlook 2003. I got this error message:

'ActiveX' Component cannot create object: Outlook.Application.
Submitted using http://www.outlookforums.com
 
S

Sue Mosher [MVP]

Never use this statement in Outlook form or VBA code:

Set objOutlook = CreateObject("Outlook.Application")

Instead, as the article I suggested explains, you should derive all Outlook
objects from the intrinsic Application object:

Set objOutlook = Application
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top