Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Check if mail is sent in vbscript:

Posted on 2002-06-24
1
324 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

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…
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

792 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