• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2327
  • Last Modified:

CDO Emails - Delivery status

I have an Access database that can send out emails using CDO.  I now want to be able to get a delivery status, and found the following link:

http://support.microsoft.com/kb/302839

However, there is one part of the code that stops the initial email from being sent:

.DSNOptions = 14

If I change this to .DSNOptions = 0, it goes (but it won't return anything).

Any ideas, my email settings are as follows?

Username: validusername
Password: validpassword
Outgoing mail server: IP address

SMTP Port 25
No SSL encryption
Type of autnehtication: 1
Send using: Network (rather than pick-up directory)
0
Andy Brown
Asked:
Andy Brown
  • 11
  • 9
2 Solutions
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
You did catch this note at the top of the MSKB article correct:

"NOTE: You can only send a message with a request for a Delivery Status Notification and a read-receipt when you use the cdoSendUsingPort method of delivery. You cannot do this when you send the e-mail message through the Pickup directory of the local Simple Mail Transfer Protocol (SMTP) server. "

So you need to be doing this:

Set Flds = iConf.Fields
With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "<SMTP Server>" 'ToDo: Type a valid SMTP server name.
    .Update
End With

Jim.
0
 
Andy BrownDeveloperAuthor Commented:
I'm pretty sure I did, but i'll double check in the morning.

Thank Jim - hope you are keeping well.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<I'm pretty sure I did, but i'll double check in the morning.>>

  Wasn't sure if you were using the code as is from the MSKB article or not.  Also noticed that with that method, you rely on the settings in the default mail account rather then the SMTP servers.  That's the most likely cause of your problem.  There may not be a MAPI profile, which I believe is what they were saying.  Your problem is mostly likely due to something with that.  

 However I haven't used CDO all that much, so I can't say for sure.  Thought I'd jump in though since no one else had.  I'll dig into it further after you've check the code.

and yeah, things are good.  Hope the same is true on your end as well!

Jim.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Andy BrownDeveloperAuthor Commented:
Here is the script and settings (minus private bits):


'Send by using the port on an SMTP server.
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML

Set iMsg = CreateObject("cdo.message")
Set iConf = CreateObject("cdo.configuration")

Set Flds = iConf.Fields
With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = 123.123.123.123
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "validusername"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "validpassword"
    .Update
End With

strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "<hr>"
strHTML = strHTML & "This another section of the message...</BR>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

With iMsg
    Set .Configuration = iConf
    .To = "mymain@emailaddress"
    .From = "senders@emailaddress"
    .Subject = "This is a test CDOSYS message (Setting DSN options)"
    .HTMLBody = strHTML

    .Fields("urn:schemas:mailheader:disposition-notification-to") = "notification@emailaddress"
    .Fields("urn:schemas:mailheader:return-receipt-to") = "notification@emailaddress"  

    'Set DSN options.
'    Name                   Value       Description
'    cdoDSNDefault             0       No DSN commands are issued.
'    cdoDSNNever               1       No DSN commands are issued.
'    cdoDSNFailure             2       Return a DSN if delivery fails.
'    cdoDSNSuccess             4       Return a DSN if delivery succeeds.
'    cdoDSNDelay               8       Return a DSN if delivery is delayed.
'    cdoDSNSuccessFailOrDelay  14      Return a DSN if delivery succeeds, fails, or is delayed.
    '.DSNOptions = cdoDSNSuccessFailOrDelay
    '.DSNOptions = 14
   
    .DSNOptions = 4
    .Fields.Update
    .Send

End With
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Andrew,

 I don't see anything wrong with that.  I would check the bad mail folder on the server and see if it's placing it there for some reason.

 For whatever reason (i.e. SMTP configuration) the server is not sending the e-mail when a read request is being issued.  That may be by design on the server.

Jim.
0
 
Andy BrownDeveloperAuthor Commented:
OK I'll check it out - thanks Jim, I'll come back to you and let you know.
0
 
Andy BrownDeveloperAuthor Commented:
Hi All - I've been intouch with the company that manages our cloud server (running 2008 R2 + hmail), and we ran a few tests whilst on the phone.  They assure me that everything is setup correctly at there end.

Is there any way I can run my own tests, or do you have any further suggestions?

Thanks as always.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Is there any way I can run my own tests, or do you have any further suggestions?>>

Without having access to the actual SMTP server, there's not much more you can do.  I suppose as a finial test, you could install Outlook or another mail client and see if you can send an e-mail with a read request.

If so, then it's something with CDO or the way it's being called.  But I have nothing else to offer on that front.  I don't use CDO, but vbSendMail for sending e-mails:

http://www.freevbcode.com/ShowCode.asp?ID=109

Jim.
0
 
Andy BrownDeveloperAuthor Commented:
Sorry, not to come back to you all sooner - I'm still testing this one (just got something else that has taken priority).
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
No problem.

Jim.
0
 
Andy BrownDeveloperAuthor Commented:
Sorry to take so long to get back to you.  My ISP says that it's not their end, so I'm going to connect to another ISP to test it.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
OK.

Jim.
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
I have client using CDO with Access to send 1000+ emails a  month with CDO.

I have also not been able to get the Delivery Status Notification (DSN) option.. I have experienced the same issues with the email not going if the DSN is set to 14.  

Using Outlook (manually and with automation) to send emails through a remote SMTP server and the DSN works fine. using CDO code in Access with the same email account the emails would no send with DSN set to 14.

Lots of search results show that lots of people have the same issue without any no solution being posted.

Can you use a DLL for sending?
0
 
Andy BrownDeveloperAuthor Commented:
Sorry about the delay, I don't see why not, but I was trying to avoid using third party plug-ins.
0
 
Andy BrownDeveloperAuthor Commented:
Hi - again, sorry for the delay in coming back to you.


Do you have a DLL driver that you would recommend?  At present, I have our software working really well simply using CDO, but if you think this is better - then I need to take a look.

Thanks for the help.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
There's BLAT and vbSendMail.  Both work well with Access and both are free.

Jim.
0
 
Andy BrownDeveloperAuthor Commented:
Thanks Jim,

My software needs to occasionally send out personalised, html broadcasts - would you have a preference?
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
I've pretty much always worked with vbSendMail as in the past, BLAT didn't have a DLL (it started as a command line utility) and when it finialy got one, the DLL was always behind in features from the command line version.  

I'm told that's no longer the case.

With vbSendMail however you must set a reference in the VBA project, which means it must be registered in Windows.  I have some VBA code for that, which runs at startup of an app, but haven't used it in production yet (I register it during my install).

BLAT however uses a native DLL I believe and as a result, doesn't need to be registered.  You just need the DLL in the path (same directory as your app would be fine) and it works.

BTW, here's links for both:

vbSendMail:   http://www.freevbcode.com/ShowCode.asp?ID=109
BLAT: http://www.blat.net/

Keep in mind that both of these simply are for sending e-mail and talk directly to a SMTP server.

And of course there are tons of other ones out there as well such as:

http://www.febooti.com/products/command-line-email/

 Overall, though I would say vbSendMail has always done it for me.

  Let me know if you want the self-registering code.

Jim.
0
 
Andy BrownDeveloperAuthor Commented:
Thanks Jim - that would be a great help.  <br /><br />Going down this route is a bit of a change, but I think it might be worth it.<br /><br />Thanks again guys - very much appreciated.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Let me know if you need help with either of those.  I've got or can get samples of using each.

Jim.
0
 
Andy BrownDeveloperAuthor Commented:
Will do - thanks Jim.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 11
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now