How about a simple switch on the machine name?

Switch (System.Environment.MachineName)
{
   case "YourMachine":
      SmtpMail.SmtpServer = "192.168.0.3";
   case default:
      SmtpMail.SmtpServer = "WhateverYouNeed";
}

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
John
Sent: Thursday, May 09, 2002 2:51 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Could not access 'CDO.Message' object


Hi,

Got it to work...added my ip to the relay list (Event though smtp is on
the
same machine!) and then change SmtpServer from Localhost to my IP like
so:

MailMessage mail = new MailMessage();
mail.From = "[EMAIL PROTECTED]";
mail.To = "[EMAIL PROTECTED]";
mail.Subject = "Mail Test";
mail.Body = "<html><body>UtilMailMessage001->success</body></html>";
mail.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = "192.168.0.3";
SmtpMail.Send(mail);

But what I don't like about this solution is that when I move it between
a
development machine and my hosting provider I'll have to change the
SmtpMail.SmtpServer Address which is a bit naf as I thought .Net was
supposed to be easy to deploy just copy the site and voila it works. CDO
with asp worked on all servers (O.K Smtp Server did need to be tweaked
occasionally but at least I did have to specify which one in my code).

Is there any way around this (Excluding things like giving the ASPNET
account System rights).  I just want to be able to write the script copy
to
my host and have it work.

Thanks,

John

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to