Solved

Check if mail is sent in vbscript:

Posted on 2002-06-24
1
325 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
[X]
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
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

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…
Read this checklist to learn more about the 15 things you should never include in an email signature.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
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…

749 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