Solved

Check if mail is sent in vbscript:

Posted on 2002-06-24
1
317 Views
Last Modified: 2010-04-08
I need some help with this section in an Outlook vbscript

*****************************************************************************
Do while not rs.eof

Set myItem = myOlApp.CreateItem(MailItem)
myItem.To = rs.fields("MailTo")
myItem.Subject = rs.fields("Subject")
myItem.Body = rs.fields("Body")
myItem.Send

conn.Execute "UPDATE tbMessages SET Sent = 1, SentOn = getDate() WHERE MessageID = " & rs.fields("MessageID")
       
rs.movenext
loop
*****************************************************************************

The "UPDATE tbMessages SET Sent ..." sql should only be fired if the mail is sent successfully.

I don't know how to check that the mail is sent successfully.
0
Comment
Question by:nr V
1 Comment
 
LVL 6

Accepted Solution

by:
Zoplax earned 200 total points
Comment Utility
You could try:

==

IF myItem.Send THEN

conn.Execute "UPDATE tbMessages SET Sent = 1, SentOn = getDate() WHERE MessageID = " & rs.fields("MessageID")

==

Not 100% sure of the IF-THEN syntax in VBScript so check on this; but I know for sure that doing it this way lets you do a boolean test of whether the Send method fires or not.

 
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
My experience with Windows 10 over a one year period and suggestions for smooth operation
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now