Solved

CDO Emails - Delivery status

Posted on 2012-04-13
21
1,965 Views
Last Modified: 2012-06-22
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
Comment
Question by:Andy Brown
  • 11
  • 9
21 Comments
 
LVL 57
ID: 37843556
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
 

Author Comment

by:Andy Brown
ID: 37843576
I'm pretty sure I did, but i'll double check in the morning.

Thank Jim - hope you are keeping well.
0
 
LVL 57
ID: 37843707
<<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
 

Author Comment

by:Andy Brown
ID: 37843722
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
 
LVL 57
ID: 37851438
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
 

Author Comment

by:Andy Brown
ID: 37851571
OK I'll check it out - thanks Jim, I'll come back to you and let you know.
0
 

Author Comment

by:Andy Brown
ID: 37923145
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
 
LVL 57
ID: 37923948
<<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
 

Author Comment

by:Andy Brown
ID: 37951379
Sorry, not to come back to you all sooner - I'm still testing this one (just got something else that has taken priority).
0
 
LVL 57
ID: 37951901
No problem.

Jim.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Andy Brown
ID: 38011893
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
 
LVL 57
ID: 38011899
OK.

Jim.
0
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 100 total points
ID: 38012438
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
 

Author Comment

by:Andy Brown
ID: 38088773
Sorry about the delay, I don't see why not, but I was trying to avoid using third party plug-ins.
0
 

Author Comment

by:Andy Brown
ID: 38110537
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
 
LVL 57
ID: 38111215
There's BLAT and vbSendMail.  Both work well with Access and both are free.

Jim.
0
 

Author Comment

by:Andy Brown
ID: 38112765
Thanks Jim,

My software needs to occasionally send out personalised, html broadcasts - would you have a preference?
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 400 total points
ID: 38112954
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
 

Author Closing Comment

by:Andy Brown
ID: 38113019
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
 
LVL 57
ID: 38113026
Let me know if you need help with either of those.  I've got or can get samples of using each.

Jim.
0
 

Author Comment

by:Andy Brown
ID: 38113055
Will do - thanks Jim.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

863 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now