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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with SmtpMail.Send()

Status
Not open for further replies.

schwank

Programmer
Sep 16, 2002
9
US
I built a C# assembly that contains functionality to send mail messages. I have done this several ways in C# before no problem. But this time I am getting an error with sending the actual message.

Stack trace:
at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText)
at ddp.ddpIntMail.sendmail()

so I call the Send() method, with either a MailMessage, or with the full argument list, and from deep in the bowels of the framework I get the

"Could not access 'CDO.Message' object" exception.

So my question: Where is the security setting that I need to loosen to allow smptmail to work again?

I have tried elevating the trust level of the assembly in the Assembly Cache Manager. Yes, I do reference the System.Web.Mail namespace. Is it due to the fact that this is running inside a DLL, and smtp is set to only allow Admins? Once this works, I am going to be spinning off a thread so as to process in an async fashion, allowing large amounts of mail to be sent without halting app execution.

Anyway, I could really use some help, I am kinda baffled here. Thanks
 
I think this has been asked before (did you do a search?)

But basically, the SmtpMail class is a wrapper around the CDO (collaborative data objects) COM object. So you need to make sure it's installed & registered on your machine, and any machine you deploy onto.

Chip H.
 
Actually, I did a cursory search yes. The kicker is that pretty much the same code(was exe, now dll) code sent out a 10000 mail blast to our mail list two weeks ago. The only two things I can figure out that have changed are IIS and running the IIS Lock Down tool.

I made sure IIS lock down did not disable FTP or SMTP, and even the exe worked under 5.1 two weeks ago. haven't re-run the exe yet, that will wait for tomorrow.

Stack trace also shows that the request made it through three levels of abstraction, each time passing the MailMessage, until the LateBinding Helper blew up.

any other hints?
 
LateBindingHelper sounds like it's in the COM Interop layer, so I'd continue following that path.

You might want to write a test app in VB6 or VBA to see if it's able to send mail via CDO on your server.

Chip H.
 
Alright then, here's where it gets weird. I can't go back to the golden days of my VB time... My box is running XP and IIS 5.1, meaning that all of my preexisting code that utilized CDO NTS will no longer work, as now I have to utilize the CDOSYS object.

Even using the Send() method and explicitly passing the subject, body, etc, will not work, nor will a MailMessage object created immediately before execution of the Send method, so it's nothing to do with my function calls or the setup. As seen by the trace, its inside the framework that it blows up.

My original EXE works, so my assumption at this point is that I am missing some required reference... anything other than System.ComponentModel required for building a DLL?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top