473,729 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SmtpMail causes application to hang...

Hello all:

Using an "Imports System.Web.Mail " clause at the head of my module, and
after executing the following code:

Dim msg As New MailMessage
msg.From = sender
msg.To = recipient
msg.Attachments .Add(New MailAttachment( attachFile))
msg.Subject = subjectString
SmtpMail.SmtpSe rver = mailservername
SmtpMail.Send(m sg)

The message is sent just fine, but then my application refuses to
terminate... when sub Main ends, it just hangs, and a glance at my task
manager shows it to be using ever-increasing amounts of memory, and my
CPU usage shoots up to 100%, and I actually have to kill the
application for it to terminate. This did not start happening until
AFTER I installed the code above...

I see the same behavior whether I explicitly destroy the MailMessage
object or not, whether I reset the mail server name or not...
Any help will be greatly appreciated!

Cheers,
zdrakec

Nov 21 '05 #1
19 3365
I don´t know the asnwer, but most of them related to System.Web.Mail are at:

http://systemwebmail.com/

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
<zd*****@yahoo. com> escribió en el mensaje
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Hello all:

Using an "Imports System.Web.Mail " clause at the head of my module, and
after executing the following code:

Dim msg As New MailMessage
msg.From = sender
msg.To = recipient
msg.Attachments .Add(New MailAttachment( attachFile))
msg.Subject = subjectString
SmtpMail.SmtpSe rver = mailservername
SmtpMail.Send(m sg)

The message is sent just fine, but then my application refuses to
terminate... when sub Main ends, it just hangs, and a glance at my task
manager shows it to be using ever-increasing amounts of memory, and my
CPU usage shoots up to 100%, and I actually have to kill the
application for it to terminate. This did not start happening until
AFTER I installed the code above...

I see the same behavior whether I explicitly destroy the MailMessage
object or not, whether I reset the mail server name or not...
Any help will be greatly appreciated!

Cheers,
zdrakec

Nov 21 '05 #2
Thanks for the link, but unfortunately, I did not see anything that
addresses this issue there...

zdrakec

Carlos J. Quintero [.NET MVP] wrote:
I don´t know the asnwer, but most of them related to System.Web.Mail are at:
http://systemwebmail.com/


Nov 21 '05 #3
Zdrakec,

This snippet you show now in this newsgroup has been here often.

Mostly is the error that the smtp mailserver is not correct. That is not in
your situation. Therefore in my opinion has it to do with an endless loop
somewhere however not in this snippet.

Just my thought,

Cor
Nov 21 '05 #4
Hello Cor:

Well, this was my first thought, but there IS no loop between the
execution of this code and the exit from Sub Main.In fact, if I step
through execution after the send method call, everything runs just
fine... but after exiting sub Main, the application doesn't terminate.
This ONLY happens if the SmptMail.Send(m sg) is invoked, otherwise
not...

Still puzzled...

Thanks,
zdrakec

Nov 21 '05 #5
Zdrakec,

Have you to test it (not for original) tried a me.close direct after the
send?

Cor
Nov 21 '05 #6
<zd*****@yahoo. com> schrieb;
Using an "Imports System.Web.Mail " clause at the head of my module, and
after executing the following code:

Dim msg As New MailMessage
msg.From = sender
msg.To = recipient
msg.Attachments .Add(New MailAttachment( attachFile))
msg.Subject = subjectString
SmtpMail.SmtpSe rver = mailservername
SmtpMail.Send(m sg)

The message is sent just fine, but then my application refuses to
terminate... when sub Main ends, it just hangs, and a glance at my task
manager shows it to be using ever-increasing amounts of memory, and my
CPU usage shoots up to 100%, and I actually have to kill the
application for it to terminate. This did not start happening until
AFTER I installed the code above...


If you are running virusscanners or firewalls, turn them off temporarily to
be sure that they don't cause the problem.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7
Hello Cor, Herfried:

There is no me.close to execute, this is being run from a module, not a
form class object. I turned off my virus scanner and firewall, but with
no change. I point out that the mail message is successfully being
sent!

I tried doing a "threading.thre ad.currentthrea d.abort" command, and
trapping the resulting ThreadAbortExce ption; however, while this does
in fact kill the app, it also gives me that annoying message
"Applicatio n has caused a problem... do you want to create a dump file"
dialog. Since this will end up being an unattended server process, I
can't have a dialog box open! I get this error despite the fact that
the exception is being caught...

More suggestions?

Cheers,
zdrakec

Nov 21 '05 #8
A co-worker had a similar problem. He commented out the line
SmtpMail.SmtpSe rver = mailservername
and SmtpMail worked.

This assumes the PC can send SmtpMail.

He thinks there was some bug in his mailservername value.

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uU******** ******@tk2msftn gp13.phx.gbl...
<zd*****@yahoo. com> schrieb;
Using an "Imports System.Web.Mail " clause at the head of my module, and
after executing the following code:

Dim msg As New MailMessage
msg.From = sender
msg.To = recipient
msg.Attachments .Add(New MailAttachment( attachFile))
msg.Subject = subjectString
SmtpMail.SmtpSe rver = mailservername
SmtpMail.Send(m sg)

The message is sent just fine, but then my application refuses to
terminate... when sub Main ends, it just hangs, and a glance at my task
manager shows it to be using ever-increasing amounts of memory, and my
CPU usage shoots up to 100%, and I actually have to kill the
application for it to terminate. This did not start happening until
AFTER I installed the code above...
If you are running virusscanners or firewalls, turn them off temporarily

to be sure that they don't cause the problem.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #9
Hello Bill:

Well, yes, when I comment that out, the problem goes away. However, the
message also does not get sent! This is why I tried resetting this to
an empty string after the send call, thus:

msg.Attachments .Clear()
msg = Nothing
SmtpMail.SmtpSe rver = ""

Thanks though!

More?

Cheers,
zdrakec

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
379
by: Jason | last post by:
Hi not sure if this is the write place, but i really need some help with this...! I have a piece of code that sends email using the SmtpMail class, in an ASP.NET web application, with integrated window authentication. it does work, and works fine on my dev machine. it also works fine on the test server, but with some considerations. on the test server, i can send emails IF they do not include any attachments. as soon as i send an email...
1
2698
by: Jens Øster | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect. I think it is a relay issue. Our system administrator will not allow relaying. In the ASP.Net web.config file I let the web application...
3
9256
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect. I think it is a relay issue. Our system administrator will not allow relaying. In the ASP.Net web.config file I let the web application...
4
7549
by: Aren Cambre | last post by:
Why does SmtpMail.Send throw an exception if the MailMessage's BodyFormat = MailFormat.Html? I've searched all over the place and cannot find a solution anywhere. I am running this on Windows XP SP2, and IIS's SMTP and WWW servers are installed. Here is the error trace: System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an...
0
1828
by: Eric van Wijk | last post by:
Hi All, After installing SP1 for Windows 2003, I'm running into the 'Error loading type library/DLL' exception when using CDO through System.Web.Mail: ------------------------------------------- //try { // security assertion
1
1122
by: ra294 | last post by:
Hi, I have a web application that sends Email on certain events. The problem is that sometimes the local mail server does not response to SmtpMail.Send and all the web application in stucked so the user can not browse anymore. I thought that a possible solution is to send the Email in new thread so the application will continue to work also when the mail server is down. What's the easiest way to accomplish this ? Anyone has an example...
2
1698
by: H. Blijlevens | last post by:
Hi y'all! I'm trying to adapt a VB.Net application that a former employee built to keep track of product issues that our customers report. While doing so, I bump into the following problem: a textbox contained in a user control that's put on a MDI Child form causes the application to hang as soon as you hit the Delete key while editing. Everything freezes and only Ctrl + Esc or Ctrl + Alt + Delete will bring things back to life.
0
990
by: Nathan Truhan | last post by:
Hello, I have a WinForms application to send out emails to a large group of students. This is not spam, but mail from our university to the students. Currentl I have a ListView with 4 columns Email, FirstName, MiddleName, LastName. I also have a form that will load users into this listview from a number of different places defined by ODBC. The population of this listview works perfectly, however with a small number of users, the...
17
6427
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. Note, the Windows task manager shows 2 CPUs on the Performance tab with hyper-threading is turned on. Both Python 2.3.5 and 2.4.3 (downloaded from python.org) have this problem. The operating system is MS Windows XP Professional.
0
8927
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8764
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9289
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9210
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6026
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4798
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3242
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2694
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.