473,748 Members | 2,502 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem clearing send error in email program

Trying to send groups of email with program using System.Net.Mail . I
do not clear MailMessage but repeatedly loop changing only the Bcc
entries. Works fine if all addresses are valid. As a simple test I
have attempted to send a valid address, then an invalid address which
my ISP (Comcast) will reject immediately as "Not our customer". I
catch the exception, display and then continue looping to send several
additional valid. The balance all are "caught" and display the an
error but they are sent. I have negligible knowledge of exceptions
but suspect I need to clear.

loop through the following changing only the bcc
try
smtpobject.Send (MyMailMsg)
Catch ex as Exception
msgbox(ex.tostr ing)
end try

Appreciate as usual,

Ed
Feb 19 '08 #1
16 1665
Ed Bitzer wrote:
Trying to send groups of email with program using System.Net.Mail . I
do not clear MailMessage but repeatedly loop changing only the Bcc
entries. Works fine if all addresses are valid. As a simple test I
have attempted to send a valid address, then an invalid address which
my ISP (Comcast) will reject immediately as "Not our customer". I
catch the exception, display and then continue looping to send several
additional valid. The balance all are "caught" and display the an
error but they are sent. I have negligible knowledge of exceptions
but suspect I need to clear.

loop through the following changing only the bcc
try
smtpobject.Send (MyMailMsg)
Catch ex as Exception
msgbox(ex.tostr ing)
end try

Appreciate as usual,

Ed
It looks to me like you need to reset MyMailMsg if there is an exception. The
exception will not persist past the end of the try block.
Feb 19 '08 #2
Ed,

Can you show the full loop, because in my idea can this not be the base of
your problem.

Cor

Feb 19 '08 #3
On Mon, 18 Feb 2008 21:53:33 -0500, Ed Bitzer wrote:
Trying to send groups of email with program using System.Net.Mail . I
do not clear MailMessage but repeatedly loop changing only the Bcc
entries. Works fine if all addresses are valid. As a simple test I
have attempted to send a valid address, then an invalid address which
my ISP (Comcast) will reject immediately as "Not our customer". I
catch the exception, display and then continue looping to send several
additional valid. The balance all are "caught" and display the an
error but they are sent. I have negligible knowledge of exceptions
but suspect I need to clear.

loop through the following changing only the bcc
try
smtpobject.Send (MyMailMsg)
Catch ex as Exception
msgbox(ex.tostr ing)
end try

Appreciate as usual,

Ed
Ed,

Post a copy of the entire loop. There are ways you can structure the loop
and the error handler to be more robust to exceptions
--
http://www.thinkersroom.com/bytes
Feb 19 '08 #4
"Mr. Arnold" <MR. Ar****@Arnold.c omschrieb:
>Trying to send groups of email with program using System.Net.Mail . I do
not clear MailMessage but repeatedly loop changing only the Bcc entries.
Works fine if all addresses are valid. As a simple test I have attempted
to send a valid address, then an invalid address which my ISP (Comcast)
will reject immediately as "Not our customer". I catch the exception,
display and then continue looping to send several additional valid. The
balance all are "caught" and display the an error but they are sent. I
have negligible knowledge of exceptions but suspect I need to clear.

loop through the following changing only the bcc
try
smtpobject.Send (MyMailMsg)
>Catch ex as Exception
msgbox(ex.tostr ing)
ex = null
or
ex = nothing 'don't know about that one for sure
No, that doesn't make sense. 'Try...Catch' as used in the OP's sample is
OK.

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

Feb 19 '08 #5

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atwrote in message
news:O3******** ******@TK2MSFTN GP05.phx.gbl...
"Mr. Arnold" <MR. Ar****@Arnold.c omschrieb:
>>Trying to send groups of email with program using System.Net.Mail . I do
not clear MailMessage but repeatedly loop changing only the Bcc entries.
Works fine if all addresses are valid. As a simple test I have
attempted to send a valid address, then an invalid address which my ISP
(Comcast) will reject immediately as "Not our customer". I catch the
exception, display and then continue looping to send several additional
valid. The balance all are "caught" and display the an error but they
are sent. I have negligible knowledge of exceptions but suspect I need
to clear.

loop through the following changing only the bcc
try
smtpobject.Send (MyMailMsg)
>>Catch ex as Exception
msgbox(ex.tostr ing)
ex = null
or
ex = nothing 'don't know about that one for sure

No, that doesn't make sense. 'Try...Catch' as used in the OP's sample is
OK.
I disagree with you, because I have used both methods to clear the Exception
to keep an application running when it would have stopped on the try/catch
while it was in a processing loop, particularly when processing many methods
within the processing loop and method calling other methods and all of them
having Try/Catches to prevent it from blowing up on the try/catch above it.

This method was used to look for a particular Exception in a multiple
Exceptions try/catch, and if I got the Exception to report the Exception to
a log, clear the Exception and let the processing flow back to the top of
the loop and continue process, otherwise, throw the Exception in each
method above it until it got to the top Try/Catch and terminate the
application.

I have used the method in C# and VB.Net solution with the try/catch and in
VB.Net with the Error GoTo.

Feb 19 '08 #6
deleted a bit to the thread to shorten, comment at bottom
>>>Catch ex as Exception
msgbox(ex.tostr ing)
ex = null
or
ex = nothing 'don't know about that one for sure

No, that doesn't make sense. 'Try...Catch' as used in the OP's
sample is OK.

I disagree with you, because I have used both methods to clear the
Exception to keep an application running when it would have stopped
on the try/catch while it was in a processing loop, particularly
when processing many methods within the processing loop and method
calling other methods and all of them having Try/Catches to prevent
it from blowing up on the try/catch above it.

This method was used to look for a particular Exception in a
multiple Exceptions try/catch, and if I got the Exception to report
the Exception to a log, clear the Exception and let the processing
flow back to the top of the loop and continue process, otherwise,
throw the Exception in each method above it until it got to the top
Try/Catch and terminate the application.

I have used the method in C# and VB.Net solution with the try/catch
and in VB.Net with the Error GoTo.
I tried and ex = null constant is no longer supported
ex= nothing ok but error repeated even for valid messages which were
sent.

I have included more extensive code as requested - appreciate your
taking a look.

Ed

\
Feb 19 '08 #7
"Mr. Arnold" <MR. Ar****@Arnold.c omschrieb:
>>>Trying to send groups of email with program using System.Net.Mail . I do
not clear MailMessage but repeatedly loop changing only the Bcc
entries. Works fine if all addresses are valid. As a simple test I
have attempted to send a valid address, then an invalid address which
my ISP (Comcast) will reject immediately as "Not our customer". I catch
the exception, display and then continue looping to send several
additional valid. The balance all are "caught" and display the an error
but they are sent. I have negligible knowledge of exceptions but
suspect I need to clear.

loop through the following changing only the bcc
try
smtpobject.Send (MyMailMsg)

Catch ex as Exception
msgbox(ex.tostr ing)
ex = null
or
ex = nothing 'don't know about that one for sure

No, that doesn't make sense. 'Try...Catch' as used in the OP's sample is
OK.

I disagree with you, because I have used both methods to clear the
Exception to keep an application running when it would have stopped on the
try/catch while it was in a processing loop
If you are catching the exception inside the loop it won't stop the loop.
Setting the exception variable to 'Nothing' doesn't have any influence if
you are using 'Catch ex As <exception type>'.
This method was used to look for a particular Exception in a multiple
Exceptions try/catch, and if I got the Exception to report the Exception
to a log, clear the Exception
You do not have to "clear" exceptions. They are not bubbled up if they are
caught and not rethrown.

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

Feb 19 '08 #8

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atwrote in message
news:eU******** ******@TK2MSFTN GP03.phx.gbl...
"Mr. Arnold" <MR. Ar****@Arnold.c omschrieb:
>>>>Trying to send groups of email with program using System.Net.Mail . I
do not clear MailMessage but repeatedly loop changing only the Bcc
entries. Works fine if all addresses are valid. As a simple test I
have attempted to send a valid address, then an invalid address which
my ISP (Comcast) will reject immediately as "Not our customer". I
catch the exception, display and then continue looping to send several
additiona l valid. The balance all are "caught" and display the an
error but they are sent. I have negligible knowledge of exceptions
but suspect I need to clear.
>
loop through the following changing only the bcc
try
smtpobject.Send (MyMailMsg)

Catch ex as Exception
msgbox(ex.tostr ing)
ex = null
or
ex = nothing 'don't know about that one for sure

No, that doesn't make sense. 'Try...Catch' as used in the OP's sample
is OK.

I disagree with you, because I have used both methods to clear the
Exception to keep an application running when it would have stopped on
the try/catch while it was in a processing loop

If you are catching the exception inside the loop it won't stop the loop.
Setting the exception variable to 'Nothing' doesn't have any influence if
you are using 'Catch ex As <exception type>'.
>This method was used to look for a particular Exception in a multiple
Exceptions try/catch, and if I got the Exception to report the Exception
to a log, clear the Exception

You do not have to "clear" exceptions. They are not bubbled up if they
are caught and not rethrown.
Look man, you can't tell me something that I have done myself. This is
totally ridiculous, particularly when I have done it.
Feb 19 '08 #9
"Mr. Arnold" <MR. Ar****@Arnold.c omschrieb:
>>>>>Trying to send groups of email with program using System.Net.Mail . I
>do not clear MailMessage but repeatedly loop changing only the Bcc
>entries. Works fine if all addresses are valid. As a simple test I
>have attempted to send a valid address, then an invalid address which
>my ISP (Comcast) will reject immediately as "Not our customer". I
>catch the exception, display and then continue looping to send
>several additional valid. The balance all are "caught" and display
>the an error but they are sent. I have negligible knowledge of
>exceptio ns but suspect I need to clear.
>>
>loop through the following changing only the bcc
>try
> smtpobject.Send (MyMailMsg)
>
>Catch ex as Exception
> msgbox(ex.tostr ing)
ex = null
or
ex = nothing 'don't know about that one for sure

No, that doesn't make sense. 'Try...Catch' as used in the OP's sample
is OK.

I disagree with you, because I have used both methods to clear the
Exception to keep an application running when it would have stopped on
the try/catch while it was in a processing loop

If you are catching the exception inside the loop it won't stop the loop.
Setting the exception variable to 'Nothing' doesn't have any influence if
you are using 'Catch ex As <exception type>'.
>>This method was used to look for a particular Exception in a multiple
Exceptions try/catch, and if I got the Exception to report the Exception
to a log, clear the Exception

You do not have to "clear" exceptions. They are not bubbled up if they
are caught and not rethrown.

Look man, you can't tell me something that I have done myself. This is
totally ridiculous, particularly when I have done it.
Well, just show me where the behavior you describe is specified and/or show
me a code sample that is a proof of what you are saying.

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

Feb 19 '08 #10

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

Similar topics

3
4371
by: Jason Callas | last post by:
I have a stored procedure that runs as a step in a scheduled job. For some reason the job does not seem to finish when ran from the job but does fine when run from a window in SQL Query. I know the job is not working because the number of rows that are inserted into the table (see code) is considerably less than the manual runnning of it. I have included the code for the stored procedure, the output from the job, and the output from...
11
6416
by: Marcus Jacobs | last post by:
Dear Group I have encountered a problem with fclose and I am wondering if anyone could provide some insight about this problem to me. Currently, I am working on a small personal project that is requiring for me to alter some existing code to a program. While running the unaltered code, I kept encountering an application (The exception unknown software exception(0xc00000fd) etc. .. etc... etc... I am running W2K Pro). Through a bit of...
8
1821
by: ra294 | last post by:
I have an ASP.net application using SQL Server 2000 that every once in a while I am getting this error: "System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached" I looked at my code and It seems that I do close every connection that I open so I don't know why I am getting...
4
1705
by: Risen | last post by:
Hi,All, I read MSDN about MessageQueue,and then I want to write some code to test MessageQueue in Vb.Net 2003. But there are some errors in code,and I don't know which code are incorrect. Who can tell me how to correct it. Thanks a lot. Risen.
26
4505
by: Tom Becker | last post by:
Is there a way, from Access, to programmatically click the Send and Receive button in Outlook?
5
6044
by: Steve Barnett | last post by:
I've tried to create a "single instance" application using a mutex and, as far as I can see, it's functioning right up until I close the application. When I try to release the mutex, I get an ApplicationException with the explanation: "Object synchronisation method was called from an unsynchronised block of code". I'm sure this tells me exactly how to fix it... well, it would if I understood it. Can anyone suggest where I'm going wrong?...
1
2248
by: sang | last post by:
Hi I prepared a program for Email Integration. That is email send to others through servlet's. I gave the code but it has some error in my code. Please check the code and give the feedback. The Servlet code: import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class MailServlet extends HttpServlet {
5
1530
by: nick048 | last post by:
Hi to All, Foollowing Your suggestion, I have written this code: #include <stdio.h> #include <string.h> #include <malloc.h> #define BUFLEN 100
3
1974
by: Kevin | last post by:
Hi everyone, I'm running Python 2.5.1 on an XP-Pro platform, with all the updates (SP2, etc) installed. I have a program (send_file.py) that sends a file to a service provider, using an ftp connection. The program works properly, and I've created an 'exe' of it, using py2exe. It was distrubuted to my user base a couple of weeks ago and seems to be working well. None of the users have Python installed on their machines, thus the need...
0
8826
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
9366
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
9316
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
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
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
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.