Re: Mailing problem - update what?

From: Rob Oldfield (rob_at_oldfield100_wow_freeserve_yikes_co_incredible!_uk)
Date: 02/13/04


Date: Fri, 13 Feb 2004 22:25:53 -0000

Many thanks for the suggestions, but before I get into the detail of
checking your suggestions, I'd like to just check on something...

At present, the SMTP server that I'm specifying is the company Exchange
server. That is working running the same code from at least one other
server in the same domain, set up in very much the same way (i.e. running
from the same account). Are you saying that, in general terms, you should
use 127.0.0.1 instead of the existing server? It seems a bit like overkill
to me to have to do this.

--
For real reply address, replace the _surprised_ bits with dots
"Iulian Ionescu" <anonymous@discussions.microsoft.com> wrote in message
news:84EEA921-FA5B-4AC7-8EED-BDFD883D8418@microsoft.com...
> I was fighting with this a while back. It has all to do with the mail
server and its relaying capabilities. Here is something I found:
>
> 4.2.3 The scary "Could not access 'CDO.Message' object" Printer Friendly
Email This FAQ   Discuss
>
> This is probably the most common error thrown by System.Web.Mail. If you
get this error, the FIRST THING TO DO, is to write out all InnerException
messages.
> This will tell you the true error and it will be easer to fix. See
Checking the Exception (READ THIS FIRST) for more information.
>
> Although this error message implies there is a permission problem,
typically there isn't. However, after trying everything else, you may will
want to try the suggestions listed at Error loading type library/DLL.
>
> Now, on to some suggestions:
>
> Suggestion 1
> Specify a valid mail server for the SmtpMail.SmtpServer property. If that
property is not set, at least set it to 127.0.0.1. For example:
> SmtpMail.SmtpServer = "127.0.0.1"
>
> Suggestion 2
> If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer,
you may not have permissions to relay through the IIS SMTP Service. To allow
access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and
right-click, then select Properties. On the Access tab, click the Relay
button. In the Relay Restrictions dialog, grant your IP address (127.0.0.1)
to the Computers listbox. Close down all dialogs, and restart the SMTP
Service.
>
> Suggestion 3
> If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer,
make sure Anonymous access is allowd. To allow access, open up the IIS Admin
MMC. Locate the SMTP Virtual Server, and right-click, then select
Properties. On the Access tab, click the Authentication button. Be sure
"Anonymous Access" is the only checkbox checked. Close down all dialogs, and
restart the SMTP Service.
>
> Suggestion 4
> The email address does not have a valid TO address. After iterating
through the InnerExceptions, you may find this error message actually has to
do with relaying. Try sending a test email to an email address that exists
on the server specified by SmtpMail.SmtpServer. If you can send an email to
that server, then it is a relay issue. Talk to your mail server
administrator about letting your code relay through the mail server.
>
> Suggestion 5
> Use a real FROM address that exists on the SmtpMail.SmtpServer. Do not use
something like "asdf@asdf.com", or some other bogus address as your
MailMessage.FromProperty. More advanced mail servers will catch this, and
will deny relaying.
>
> Suggestion 6
> I have no idea why this suggestion works, but I found it on the web. I
figured I would mention it, just in case Suggestion 1 did not work. Instead
of specifying
> SmtpMail.SmtpServer = "127.0.0.1"
> try
> SmtpMail.SmtpServer.Insert( 0, "127.0.0.1 or your mail server name here")
>
> Like I said, I don't know why this would work, but here is the thread:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF8&newwindow=1&threa
dm=ePdwqQfZDHA.2136%40TK2MSFTNGP10.phx.gbl&rnum=75&prev=/groups%3Fq%3Dcdo.me
ssage%2Bgroup:microsoft.public.dotnet.*%26num%3D50%26hl%3Den%26lr%3D%26ie%3D
UTF-8%26oe%3DUTF8%26newwindow%3
>