Send email via external SMTP Server

G

Guest

I am working with three computers, my developing computer, a Web Server and a
Mail Server (Exchange).

I am trying to send a email from the Web Server via the Mail Server to a
valid email address with this code:

MailMessage msgMail = new MailMessage();
msgMail.To = "(e-mail address removed)";
msgMail.From = "(e-mail address removed)";
msgMail.Subject = "Mail Example Subject";
msgMail.Body = "MAIL EXAMPLE BODY";
SmtpMail.SmtpServer = "[Server Name]";
SmtpMail.Send(msgMail);

Which does not work.

My biggest problem is that everything works perfectly on my developing
computer when I try to send mail via the Mail Server with the same code.

Why can't I send mail from the Web Server?
 
W

Willie

System.Web.Mail use CDO. The CDO dll (cdo.dll, cdont.dll or cdoex.dll, I can't remember which one .NET use) is probably installed on you dev box, but not on the web server.

If this does not work catch the exception and check the InnerException for a more detailed message why it failed.

Willie

nntp://news.microsoft.com/microsoft.public.dotnet.framework.aspnet/<[email protected]>

I am working with three computers, my developing computer, a Web Server and a
Mail Server (Exchange).

I am trying to send a email from the Web Server via the Mail Server to a
valid email address with this code:

MailMessage msgMail = new MailMessage();
msgMail.To = "(e-mail address removed)";
msgMail.From = "(e-mail address removed)";
msgMail.Subject = "Mail Example Subject";
msgMail.Body = "MAIL EXAMPLE BODY";
SmtpMail.SmtpServer = "[Server Name]";
SmtpMail.Send(msgMail);

Which does not work.

My biggest problem is that everything works perfectly on my developing
computer when I try to send mail via the Mail Server with the same code.

Why can't I send mail from the Web Server?


[microsoft.public.dotnet.framework.aspnet]
 
J

Jim Lawton

I am working with three computers, my developing computer, a Web Server and a
Mail Server (Exchange).

I am trying to send a email from the Web Server via the Mail Server to a
valid email address with this code:

MailMessage msgMail = new MailMessage();
msgMail.To = "(e-mail address removed)";
msgMail.From = "(e-mail address removed)";
msgMail.Subject = "Mail Example Subject";
msgMail.Body = "MAIL EXAMPLE BODY";
SmtpMail.SmtpServer = "[Server Name]";
SmtpMail.Send(msgMail);

Which does not work.

exception? no mail in queue? something else?

I've had trouble with SMTP and my local machine firewall - symptom was mail
sitting in the queue...

J
 
G

Guest

Thanks for the reply!

I still have the same problem and I have found out that I have these DLL's
installed:

I have on the win2003 Web Server:
cdosys.dll
mapi32.dll

I do NOT have on the win2003 Web Server
cdonts.dll
cdo.dll
cdoex.dll

---------------------------------------

I have in my XP dev. computer:
cdo.dll
cdosys.dll
mapi32.dll

I do NOT have in my XP dev. computer:
cdonts.dll
cdoex.dll

I an trying to catch the expection but nothing is being thrown...

/ Andreas
 
J

Juan T. Llibre

Glad that got you on the right track, Andreas.



Juan T. Llibre
ASP.NET MVP
===========
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top