I want to send an email in release mode but not in debug mode, how
would I accomplish this?
Here is my email code (using vb.net, visual studio 2005, winxp pro
sp2):
Try
Dim MailMsg As New MailMessage(New
MailAddress("fr**@mycompany.com"), New
MailAddress("to************@mycompany.com")) 'from, to
MailMsg.Subject = "Program Generated an Error"
MailMsg.Body = "List Error number and description here"
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
SmtpMail.Host = "MYEXCHANGESERVER"
SmtpMail.Send(MailMsg) 'sends the email
Catch ex As System.Exception
'Message Error
End Try 4 2041
Try something like this
SmtpMail.Host = "MYEXCHANGESERVER"
#If Not Debug then
SmtpMail.Send(MailMsg) 'sends the email
#Endif
Catch ex As System.Exception
Ken
--------------------------
"Mel" wrote:
I want to send an email in release mode but not in debug mode, how
would I accomplish this?
Here is my email code (using vb.net, visual studio 2005, winxp pro
sp2):
Try
Dim MailMsg As New MailMessage(New
MailAddress("fr**@mycompany.com"), New
MailAddress("to************@mycompany.com")) 'from, to
MailMsg.Subject = "Program Generated an Error"
MailMsg.Body = "List Error number and description here"
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
SmtpMail.Host = "MYEXCHANGESERVER"
SmtpMail.Send(MailMsg) 'sends the email
Catch ex As System.Exception
'Message Error
End Try
On Oct 9, 8:35*pm, Ken Tucker [MVP]
<KenTucker...@discussions.microsoft.comwrote:
Try something like this
* * * * * * *SmtpMail.Host = "MYEXCHANGESERVER"
#If Not Debug then
* * * * * * *SmtpMail.Send(MailMsg) *'sends the email
#Endif
* * * * *Catch ex As System.Exception
Ken
--------------------------
"Mel" wrote:
I want to send an email in release mode but not in debug mode, how
would I accomplish this?
Here is my email code (using vb.net, visual studio 2005, winxp pro
sp2):
* * * * Try
* * * * * * Dim MailMsg As New MailMessage(New
MailAddress("f...@mycompany.com"), New
MailAddress("tothedevelo...@mycompany.com")) 'from, to
* * * * * * MailMsg.Subject = "Program Generated an Error"
* * * * * * MailMsg.Body = "List Error number and description here"
* * * * * * MailMsg.Priority = MailPriority.High
* * * * * * MailMsg.IsBodyHtml = True
* * * * * * 'Smtpclient to send the mail message
* * * * * * Dim SmtpMail As New SmtpClient
* * * * * * SmtpMail.Host = "MYEXCHANGESERVER"
* * * * * * SmtpMail.Send(MailMsg) *'sends the email
* * * * Catch ex As System.Exception
* * * * * * 'Message Error
* * * * End Try- Hide quoted text -
- Show quoted text -
Thanks, that worked great.
On Oct 10, 8:08*am, Mel <MLights...@gmail.comwrote:
On Oct 9, 8:35*pm, Ken Tucker [MVP]
<KenTucker...@discussions.microsoft.comwrote:
Try something like this
* * * * * * *SmtpMail.Host = "MYEXCHANGESERVER"
#If Not Debug then
* * * * * * *SmtpMail.Send(MailMsg) *'sends the email
#Endif
* * * * *Catch ex As System.Exception
Ken
--------------------------
"Mel" wrote:
I want to send an email in release mode but not in debug mode, how
would I accomplish this?
Here is my email code (using vb.net, visual studio 2005, winxp pro
sp2):
* * * * Try
* * * * * * Dim MailMsg As New MailMessage(New
MailAddress("f...@mycompany.com"), New
MailAddress("tothedevelo...@mycompany.com")) 'from, to
* * * * * * MailMsg.Subject = "Program Generated an Error"
* * * * * * MailMsg.Body = "List Error number and description here"
* * * * * * MailMsg.Priority = MailPriority.High
* * * * * * MailMsg.IsBodyHtml = True
* * * * * * 'Smtpclient to send the mail message
* * * * * * Dim SmtpMail As New SmtpClient
* * * * * * SmtpMail.Host = "MYEXCHANGESERVER"
* * * * * * SmtpMail.Send(MailMsg) *'sends the email
* * * * Catch ex As System.Exception
* * * * * * 'Message Error
* * * * End Try- Hide quoted text -
- Show quoted text -
Thanks, that worked great.
You can also use System.Diagnostics.Debugger.IsAttached to detect
whether the application is being debugged, this can have benefits over
using a precompiler statement.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
"rowe_newsgroups" <ro********@yahoo.comschreef in bericht
news:c9**********************************@a18g2000 pra.googlegroups.com...
On Oct 10, 8:08 am, Mel <MLights...@gmail.comwrote:
On Oct 9, 8:35 pm, Ken Tucker [MVP]
<KenTucker...@discussions.microsoft.comwrote:
Try something like this
SmtpMail.Host = "MYEXCHANGESERVER"
#If Not Debug then
SmtpMail.Send(MailMsg) 'sends the email
#Endif
Catch ex As System.Exception
Ken
--------------------------
"Mel" wrote:
I want to send an email in release mode but not in debug mode, how
would I accomplish this?
Here is my email code (using vb.net, visual studio 2005, winxp pro
sp2):
Try
Dim MailMsg As New MailMessage(New
MailAddress("f...@mycompany.com"), New
MailAddress("tothedevelo...@mycompany.com")) 'from, to
MailMsg.Subject = "Program Generated an Error"
MailMsg.Body = "List Error number and description here"
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
SmtpMail.Host = "MYEXCHANGESERVER"
SmtpMail.Send(MailMsg) 'sends the email
Catch ex As System.Exception
'Message Error
End Try- Hide quoted text -
- Show quoted text -
Thanks, that worked great.
>You can also use System.Diagnostics.Debugger.IsAttached to detect whether the application is being debugged, this can have benefits over using a precompiler statement.
>Thanks,
>Seth Rowe [MVP] http://sethrowe.blogspot.com/
Yes advantages and dissadvantages :-)
1 . if using System.Diagnostics.Debugger.IsAttached this would mean that
the code is delivered with your assembly
while in Ken`s solution the code is there when needed and removed when it
isn`t ( so the mail code would not be in the assembly )
2. debugging the compiled executable because it doesn`t send e-mails is
getting impossible
3. using runtime checks makes the app slower , while using a precompile
contstant the app gets faster when you remove the unnecesary code
regards
Michel Posseth [MCP] http://www.vbdotnetcoder.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Srinivasa Rao |
last post by:
I have read in one article that when we compile the application in release
mode, all the debug classes and properties will be automatically removed from
the code. I tried to implement this thing by...
|
by: dee |
last post by:
Hi
I'm about to upload my site and I have switched to release version. Is that
enough or do I still need to disable
<compilation defaultLanguage="vb" debug="true" />
the debug="true" in the .pdb...
|
by: |
last post by:
Since I need to dotfuscate my exe file anyway, does it make any
difference if I use Debug or Release versions. Would a Debug
version be easier to decompile/study/reverse engineer than a
Release...
|
by: Epetruk |
last post by:
Hello,
In VS2003, I used to have two solutions - a debug and release solution.
Each solution had a webservice project and several other class library
projects. The webservice project...
|
by: Epetruk |
last post by:
Hello,
I have a problem where an application I am working on throws an
OutOfMemoryException when I run it in Release mode, whereas it doesn't do
this when I am running in Debug.
The...
|
by: Andrew Rowley |
last post by:
I am having trouble getting debug and release builds to work properly
with project references using C++ .NET and Visual Studio 2003.
I created a test solution, with a basic Windows form C++...
|
by: Bob Johnson |
last post by:
It is my understanding - and please correct me if I'm wrong - that when
building a project in debug mode, I can deploy the .pdb file along with the
..exe and thereby have access to the specific...
|
by: TBass |
last post by:
Hello,
Is there a way to get Visual Studio 2003 look to one directory for
debug version dlls when set to DEBUG and then to another directory
where I store the release version of a dll when set...
|
by: Dave Johansen |
last post by:
I just converted a solution from Visual Studio 2003 to Visual Studio
2005 and the Debug mode seems to be running just fine, but the Release
mode crashes on the following code:
std::ifstream...
|
by: =?Utf-8?B?bG10dGFn?= |
last post by:
We have developed a number of different applications (ASP.NET web site,
Windows services, DLLs, Windows forms, etc.) in C# 2.0. We have developed
and unit tested all these applications/components...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |