473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Update on system.net.mail behaviour I think this is important.

Bob
Vs2005 - Framework2. Just to let all of you know. I have found that I can
not use an application to send e-mails using the system,net.mail namespace
while Outlook express is opened on the same machine from which my program is
trying to send an e-mail using smtp mail set to the same smtp server account
as the currently selected outlook mail account. (code snippet follows at
end) the application just does not send e-mail and no exception is
generated.

I started a new thread on this because if what I detected is true it may be
critical to many apps and I want to bring this to your attention.

If this is indeed the case it has some serious implications that warrant
looking into by MS. Say you have a service running that is sending e-mails
of warnings of critical events in certain apps on your computer and it is
configured to use the same smtp account as your outlook. This would mean
that your service would not be sending these notifications if your outlook
is open on the sending computer and there's no way you would know.
Definitely not good behaviour.

Has anyone else noted something similar. If it works Ok for you while
outlook is open what is different in your code from mine?

This is the code being used on a form with just one button to test it. All
it does is send an e-mail from me to myself. The smtp server is not
colocated on my computer but is hosted by a provider outside my LAN. The
smtp service is running on my local host and I have an instance of IIS used
for testing on my local host. I don't know if the above influences anything.
I do know that in Vs2003 when I used system.web.mail to send e-mails I
needed to have IIS running and did not encounter this type of problem. But
since MS deprecated the system.web.mail I thought I'd go with the flow. Not
sure it was a good idea <GGGG>. Anyways, here's the snippet.

Please test it and let me know if you encounter the same situation.
Imports System.net.mail 'before class declaration
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim message As New MailMessage()
Try
message.From = New MailAddress("my****@mydomain.com")
message.To.Add(New MailAddress("my****@mydomain.com"))
message.Subject = "Test"
message.Body = "Test body"
Dim Client As New SmtpClient()
Client.Host = "mail.mydomain.com"
Client.Port = 25
Dim LoginCredentials As New
System.Net.NetworkCredential("my****@mydomain.com" , "mypassword")
Client.UseDefaultCredentials = False
Client.Credentials = LoginCredentials
Client.Send(message)
Catch ex As SmtpException
MsgBox(ex.Message)
End Try
End Sub

Thanks to all

Bob


Feb 1 '06 #1
1 1462
Bob
Sorry I said Outlook express, weas mistake. Am using Outlook 2003. Rest all
same
Fingers tired
Bob
"Bob" <bd*****@sgiims.com> wrote in message
news:eV*************@TK2MSFTNGP15.phx.gbl...
Vs2005 - Framework2. Just to let all of you know. I have found that I can
not use an application to send e-mails using the system,net.mail namespace
while Outlook express is opened on the same machine from which my program
is trying to send an e-mail using smtp mail set to the same smtp server
account as the currently selected outlook mail account. (code snippet
follows at end) the application just does not send e-mail and no exception
is generated.

I started a new thread on this because if what I detected is true it may
be critical to many apps and I want to bring this to your attention.

If this is indeed the case it has some serious implications that warrant
looking into by MS. Say you have a service running that is sending e-mails
of warnings of critical events in certain apps on your computer and it is
configured to use the same smtp account as your outlook. This would mean
that your service would not be sending these notifications if your outlook
is open on the sending computer and there's no way you would know.
Definitely not good behaviour.

Has anyone else noted something similar. If it works Ok for you while
outlook is open what is different in your code from mine?

This is the code being used on a form with just one button to test it. All
it does is send an e-mail from me to myself. The smtp server is not
colocated on my computer but is hosted by a provider outside my LAN. The
smtp service is running on my local host and I have an instance of IIS
used for testing on my local host. I don't know if the above influences
anything. I do know that in Vs2003 when I used system.web.mail to send
e-mails I needed to have IIS running and did not encounter this type of
problem. But since MS deprecated the system.web.mail I thought I'd go with
the flow. Not sure it was a good idea <GGGG>. Anyways, here's the snippet.

Please test it and let me know if you encounter the same situation.
Imports System.net.mail 'before class declaration
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim message As New MailMessage()
Try
message.From = New MailAddress("my****@mydomain.com")
message.To.Add(New MailAddress("my****@mydomain.com"))
message.Subject = "Test"
message.Body = "Test body"
Dim Client As New SmtpClient()
Client.Host = "mail.mydomain.com"
Client.Port = 25
Dim LoginCredentials As New
System.Net.NetworkCredential("my****@mydomain.com" , "mypassword")
Client.UseDefaultCredentials = False
Client.Credentials = LoginCredentials
Client.Send(message)
Catch ex As SmtpException
MsgBox(ex.Message)
End Try
End Sub

Thanks to all

Bob

Feb 1 '06 #2

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

Similar topics

17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
7
by: Alex | last post by:
Hi all, I am trying to install a java stored procedure via the windows development centre. The linux box is running 8.1 FP4 as is the windoze platform. If I am on the linux box i can install...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
5
by: sugaray | last post by:
Right now, the code I wrote below seems works fine, i know it's definitely not the best solution, so if there are better solutions to eschew from using goto statements to jump out of multiple loops...
8
by: Will Pittenger | last post by:
I have a Windows program C# .NET solution where when I update its XML documentation, some tags are not recognized and turned into the corresponding HTML. Those tags include <c>, <code>, <para>,...
5
by: Alastair Anderson | last post by:
I have created a very simple form with which I would like to update a single value in a single row of a database as a proof of concept. The relevant parts of the form are a DBWebTextBox (which...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
3
by: J055 | last post by:
Hi I have a PlaceHolder control inside a FormView EditItemTemplate: <asp:PlaceHolder ID="phResponseText" runat="server"> <tr> <td> <asp:Label ID="lblResponseText"...
6
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem :...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.