Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Check if mail is sent in vbscript:

Posted on 2002-06-24
1
Medium Priority
?
345 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 800 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
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 …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

688 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