Solved

Check if mail is sent in vbscript:

Posted on 2002-06-24
1
323 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
ID: 7107484
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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