Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Send email via external SMTP Server

Reply
Thread Tools

Send email via external SMTP Server

 
 
=?Utf-8?B?QW5kcmVhcw==?=
Guest
Posts: n/a
 
      01-14-2005
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 Removed)";
msgMail.From = "(E-Mail 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?
 
Reply With Quote
 
 
 
 
Willie
Guest
Posts: n/a
 
      01-14-2005
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/<(E-Mail Removed)>

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 Removed)";
msgMail.From = "(E-Mail 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]


 
Reply With Quote
 
 
 
 
Jim Lawton
Guest
Posts: n/a
 
      01-14-2005
On Fri, 14 Jan 2005 02:23:01 -0800, "Andreas"
<(E-Mail Removed)> wrote:

>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 Removed)";
>msgMail.From = "(E-Mail 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

>
>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?


 
Reply With Quote
 
=?Utf-8?B?QW5kcmVhcw==?=
Guest
Posts: n/a
 
      01-17-2005
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
 
Reply With Quote
 
=?Utf-8?B?QW5kcmVhcw==?=
Guest
Posts: n/a
 
      01-18-2005
Thank you very much!

Everything works perfectly now!

/Andreas


"Juan T. Llibre" wrote:

> Hi, Andreas.
>
> Windows 2003 doesn't use CDONTS.
>
> It uses System.Web.Mail ( which uses cdosys )
> for .Net apps.
>
> See
> http://support.microsoft.com/default...1&PA=1&SD=HSCH
>
> You might want to test your capacity to send email
> using the CDO Object in W2K3 ( CDOSYS )
> by modifying the attached .vbs script and running it.
>
> The script is available online at Microsoft at
> http://support.microsoft.com/kb/286431?FR=1
>
> You can download it from there, or use the attached file.
> They're the same file.
>
> I added a .txt extension in case the .vbs extension
> is blocked by your client email program or ISP.
>
> You'll need to erase the ".txt" part of
> the filename so it can run as a .vbs script.
>
> You can edit it by highlighting the .vbs file
> right-clicking it, and selecting "Edit" from the menu.
>
> Then, all you need to change is the name of the remote smtp
> server's name, the "To:" address and the "From:" address.
>
> Place the modified file in any directory ( I used the "temp" dir )
> and double-click the vbs file from within Windows Explorer.
>
> If your system is configured correctly, the CDOSYS mail
> will be sent and you should receive in a very short time.
>
> There's several reasons why you might not
> be being allowed to send CDOSYS mail.
>
> The most common one is that the remote smtp server
> requires authentication. i.e., that you might not have
> sufficient permissions to send mail through that server.
>
> Many companies require authentication because if they
> ran open relay smtp servers, they'd be liable for all SPAM
> mail sent through their smtp server, not to mention that the
> bandwidht consumed would cost a small fortune
> ( maybe even a large fortune ) when spammers find out
> that they can send mail through an open relay smtp server.
>
> Another very common situation is that your ISP
> is blocking packets on the port you need to send mail.
>
> ( Again, Many ISPs don't want the possibility of their clients
> unwittingly serving as relay servers for spammers. )
>
> Running this test will at least enable you to know
> whether your system is configured to send email
> using CDOSYS, and whether your ISP's configuration
> allows mail to be sent through their smtp server.
>
> Then we could look for the reasons why
> it's not working from your ASP.NET app.
>
> Let us know how it goes.
>
>
>
> Juan T. Llibre
> ASP.NET MVP
> ===========
> "Andreas" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      01-18-2005
Glad that got you on the right track, Andreas.



Juan T. Llibre
ASP.NET MVP
===========
"Andreas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank you very much!
>
> Everything works perfectly now!
>
> /Andreas
>
>
> "Juan T. Llibre" wrote:
>
>> Hi, Andreas.
>>
>> Windows 2003 doesn't use CDONTS.
>>
>> It uses System.Web.Mail ( which uses cdosys )
>> for .Net apps.
>>
>> See
>> http://support.microsoft.com/default...1&PA=1&SD=HSCH
>>
>> You might want to test your capacity to send email
>> using the CDO Object in W2K3 ( CDOSYS )
>> by modifying the attached .vbs script and running it.
>>
>> The script is available online at Microsoft at
>> http://support.microsoft.com/kb/286431?FR=1
>>
>> You can download it from there, or use the attached file.
>> They're the same file.
>>
>> I added a .txt extension in case the .vbs extension
>> is blocked by your client email program or ISP.
>>
>> You'll need to erase the ".txt" part of
>> the filename so it can run as a .vbs script.
>>
>> You can edit it by highlighting the .vbs file
>> right-clicking it, and selecting "Edit" from the menu.
>>
>> Then, all you need to change is the name of the remote smtp
>> server's name, the "To:" address and the "From:" address.
>>
>> Place the modified file in any directory ( I used the "temp" dir )
>> and double-click the vbs file from within Windows Explorer.
>>
>> If your system is configured correctly, the CDOSYS mail
>> will be sent and you should receive in a very short time.
>>
>> There's several reasons why you might not
>> be being allowed to send CDOSYS mail.
>>
>> The most common one is that the remote smtp server
>> requires authentication. i.e., that you might not have
>> sufficient permissions to send mail through that server.
>>
>> Many companies require authentication because if they
>> ran open relay smtp servers, they'd be liable for all SPAM
>> mail sent through their smtp server, not to mention that the
>> bandwidht consumed would cost a small fortune
>> ( maybe even a large fortune ) when spammers find out
>> that they can send mail through an open relay smtp server.
>>
>> Another very common situation is that your ISP
>> is blocking packets on the port you need to send mail.
>>
>> ( Again, Many ISPs don't want the possibility of their clients
>> unwittingly serving as relay servers for spammers. )
>>
>> Running this test will at least enable you to know
>> whether your system is configured to send email
>> using CDOSYS, and whether your ISP's configuration
>> allows mail to be sent through their smtp server.
>>
>> Then we could look for the reasons why
>> it's not working from your ASP.NET app.
>>
>> Let us know how it goes.
>>
>>
>>
>> Juan T. Llibre
>> ASP.NET MVP
>> ===========
>> "Andreas" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send email programmatically from a gmail email a/c when port587(smtp) is blocked ashish makani Python 5 09-20-2012 07:56 AM
How to send email with no outlook and SMTP server ? fniles ASP General 22 04-29-2010 05:07 AM
Re: smtplib send email by using gmail smtp server Gabriel Genellina Python 0 05-03-2009 06:08 PM
How to send E-mail without an external SMTP server ? fdu.xiaojf@gmail.com Python 12 10-16-2006 07:31 PM
Send email through a SMTP Server that requires authentication Rodrigo ASP .Net 1 08-28-2003 12:45 PM



Advertisments