Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I check if E-Mail is sent?

Status
Not open for further replies.

IRABYY

Programmer
Apr 18, 2002
221
US
Fellows,

I'm still struggling with E-Mail, but on more deep level. The problem I'm having now is verification if the message has been sent. The following is the code that does the sending (I'm using Collaboration Data Objects, or CDO, by suggestion from Mike Gagnon):
Code:
   loMSG = CREATEOBJECT("cdo.message")
   loMSG.To = <Recipient address>
   loMSG.From = lcKeyValueData  && Sender's E-Mail Address, obtained from the Windows Registry
   loMSG.Subject = <Subject line>
   loMSG.TextBody = loMSG.Subject
   loMSGAtt = loMSG.AddAttachment(<Full Path To Attachment File>)
   loMSG.Send()

So far - so good (as a handiman said, falling from the roof of 100-store building, when passing 31st floor [smile] )

Now I have to check if this E-Mail has been actually sent - and at that point I hit the snag.

Attempts to use .Submitted or .Sent properties in the following lines gave me the same OLE error &quot;0x80020006: Unknown name&quot;:
Code:
IF !loMSG.Submitted && !loMSG.Sent
      = MESSAGEBOX([Cannot send files ] ...
   ...
ENDIF
According to the CDO.CHM, both .Sent and .Submitted properties belong to CDO Message object, both s./b. set to True if E-Mail actually has gone through.

What am I doing wrong?

AHWBGA.

Regards,

Ilya

P.S. The funniest thing is that before I started &quot;piddling&quot; with .Sent/.Submitted, the message went out and reached recipient (even though my own E-Mail address) with no problem at all.
 
Ilya

You could use the
loMsg.MDNRequested =.t. && Message Delivery notification, with would send you back an e-mail confirming dans the receipient received his e-mail. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
mgagnon (Programmer)
Ilya

You could use the
loMsg.MDNRequested =.t. && Message Delivery notification

Not exactly The Solution:

a) It does not verify that the message HAS BEEN SENT, which is what I need. Because it's for the customers to send data to us, not vice versa, we must make darn sure customer is notified right away that the message has indeed gone through, lest we get these &quot;Your program ain't workin'!&quot; calls. [smile]

b) It ain't helping in Web-based E-Mail systems (i.e. AOL): AOL, for instance, has no '&quot;Message Read&quot; Receipt' feature.

Any other suggestions? IAAE [bigears]

(BTW: I found the .DeliveryReceipt property in CDO.CHM, but could not find the property .MDNRequested - [ponder] It's Help for CDO 1.2.1 though.)

Regards,

Ilya
 
Ilya
It does not verify that the message HAS BEEN SENT, which is what I need. Because it's for the customers to send data to us, not vice versa, we must make darn sure customer is notified right away that the message has indeed gone through, lest we get these &quot;Your program ain't workin'!&quot; calls.


This link describes the DSNOptions property (Delivery Status notification)

And this link describes MDNRequested (Mail delivery notification)
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

Sorry, colleague, none of your 2 latest suggestions helped. [sad]

1. Use MDNRequested:

I added the statement loMSG.MDNRequested = .T. into the code. By doing so, I hit a snug: I need to move the files, after they've been sent, to a subdir. &quot;Move&quot; means copy-to-subdir-and-delete-the-originals. And, when it comes to DELETE FILES <FullPath> the error &quot;File access denied&quot; pops up. As I suspect, if MDNRequested = .T. then loMSG still keeps the grip on the sent files even though I explicitly RELEASE ALL LIKE loMSG* way before issuing DELETE FILES command. So I had to remove the loMSG.MDNRequested = .T. statement from the code.

2. Use DSNOptions:

After I added loMSG.DSNOptions(14) - error message &quot;OLE error code 0x80020011: Does not support a collection.&quot; Attempt to find which CDO collection this property belongs to by searching MSDN brough 0 results: I still do not know how to properly implement this feature. Besides, I'm afraid it will lock the grip by CDO on the attached files, too. So, I had to remove that statement from the code also.

Out of despair, I even tried to use SentOn property, i.e.
Code:
***** Debug *****
IF glDevelop
 WAIT WINDOW [Your E-Mail was sent on ] + TTOC(loMSG.SentOn)ENDIF
*****************
It turned out that:

a) SentOn property is populated, no matter what, with the time I hit the Send button, even if the message never leaves my station (I pulled out the network cable), although an error message pops up allright.

b) Referencing this property also retains the hold on the attacment files (&quot;File access denied&quot; again on DELETE FILE command).

So, I had to abandon that idea, and remove the reference on the SentOn property also.

The last resort would be just throw my hands up [sad], go back to MAPI controls and let them enter the address by typing, and that's exactly what I am trying so hard to avoid by any means.

Any other ideas, anybody?

AHWBGA

Regards,

Ilya
 
Ilya

loMSG.DSNOptions(14)

This being VFP, things are sometimes a little different. Try using:
oms.DSNOptions= 14 && cdoDSNSuccessFailOrDelay
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

loMSG.DSNOptions = 14 did not bring any problems.

Now, while testing, I sent scores of E-Mails to the certain address - our Operations Dept. NONE OF THEM CAME THROUGH [ponder] whether I sent them with or without that DNSOptions statement in place.

At the same time, when I sent them to my own company address, or on my AOL address - they all come through allright. And I cannot blame the restrictions on the attachments: I send DBF and CDX files, and I receive files of that type with no problem. Moreover, I manually sent E-Mail, similar to what I've been sending programmatically, with the same attachments, from my Outlook Express on our Ops. Dept. E-Mail address - she got it allright, attachments and all.

Yet another disapointment: I spent hours searching/reading MSDN trying to find ho to actually check the status of the sent E-Mail - found nothing...

Dead end? [sad] So many efforts, yours and mine - down the drain...

Ilya
 
Hi IRABYY
Have u found the solution ? Or anybody that can solve this problem ?
 
andreateh

Since CDO does not keep a copy of the sent message (Unless you use it in conjunction with Exchange Server), it is difficult to determine if the e-mail was ever sent, and even if you ask for receipt confirmation, the user can also decline to respond to it. So if you need to send e-mails from your application, but require guaranties that the e-mail was if fact sent and received, then I would suggest that CDO is not the tool to use in this situation. CDO is either ment more for a mass e-mail type program (where 100% sent is not required) or just the transport portion of an e-mail application, where other means for tracking e-mail movements are being implemented.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top