smtpauthenticate & ASPNET_SETREG

M

Mark Rae

Hi,

I'm working on an ASP.NET intranet site which is still in v1.1 of the
Framework. We are using ASPNET_SETREG to impersonate a domain user for
various reasons, as follows:

<identity impersonate="true"
userName="registry:HKLM\SOFTWARE\Intranet\identity\ASPNET_SETREG,userName"
password="registry:HKLM\SOFTWARE\Intranet\identity\ASPNET_SETREG,password"
/>

Works perfectly.

However, we now have a requirement to get the site to send external email.
When I first tried this, I got the "Unable to relay..." CDO message. Looking
this up on www.systemwebmail led me to add the following to the SendMail
code:

objMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1");
objMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
"<userid>");
objMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
"<password>");
SmtpMail.SmtpServer = "<mailserver>";
SmtpMail.Send(objMsg);

That now allows the site to send external mail, which is fine so long as I
hard-code the username and password into the above code.

Is there anyway that I can combine the two i.e. get the CDO fields from the
registry in the same way as ASP.NET does when implementing the
impersonation?

Any assistance gratefully received.

Best,

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top