473,320 Members | 1,930 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,320 software developers and data experts.

unable to connect to the remote server while sending email

Hi,

I have created a windows application to send the emails. Following is the
code I am using.

Dim errMsg As String
Dim ToAddress As String
Dim FromAddress As String
Try
ToAddress = "to**@mycompany.com"
FromAddress = "fr*********@mycompany.com"
Dim mm As New MailMessage(FromAddress, ToAddress)

mm.Subject = "Test"
mm.Body = "Test Email"
mm.IsBodyHtml = False

Dim smtp As New SmtpClient
smtp.Send(mm)

Catch ex As Exception
errMsg = ex.InnerException.Message
End Try

In the app.config I specified
<system.net>
<mailSettings>
<smtp>
<network host ="myexchangeserveripaddress" />
</smtp>
</mailSettings>
</system.net>

I am running this code on windows vista. I am not sure if that is the issue.
If so how could I resolve that?

Thanks,
Oct 18 '07 #1
3 15873
On Thu, 18 Oct 2007 05:36:01 -0700, Sridhar
<Sr*****@discussions.microsoft.comwrote:
>Hi,

I have created a windows application to send the emails. Following is the
code I am using.

Dim errMsg As String
Dim ToAddress As String
Dim FromAddress As String
Try
ToAddress = "to**@mycompany.com"
FromAddress = "fr*********@mycompany.com"
Dim mm As New MailMessage(FromAddress, ToAddress)

mm.Subject = "Test"
mm.Body = "Test Email"
mm.IsBodyHtml = False

Dim smtp As New SmtpClient
smtp.Send(mm)

Catch ex As Exception
errMsg = ex.InnerException.Message
End Try

In the app.config I specified
<system.net>
<mailSettings>
<smtp>
<network host ="myexchangeserveripaddress" />
</smtp>
</mailSettings>
</system.net>

I am running this code on windows vista. I am not sure if that is the issue.
If so how could I resolve that?

Thanks,
What is the problem? You'd get more (and better) assistance if you
specify what your problem is.

--
http://bytes.thinkersroom.com
Oct 18 '07 #2
I put the error message in the subject. This is the detailed error message

System.Net.Mail.SmtpException - Failure sending mail.
InnerException - Unable to connect to Remote server.
No Connection could be made because the target machine actively
refused it.

Thanks,

"Rad [Visual C# MVP]" wrote:
On Thu, 18 Oct 2007 05:36:01 -0700, Sridhar
<Sr*****@discussions.microsoft.comwrote:
Hi,

I have created a windows application to send the emails. Following is the
code I am using.

Dim errMsg As String
Dim ToAddress As String
Dim FromAddress As String
Try
ToAddress = "to**@mycompany.com"
FromAddress = "fr*********@mycompany.com"
Dim mm As New MailMessage(FromAddress, ToAddress)

mm.Subject = "Test"
mm.Body = "Test Email"
mm.IsBodyHtml = False

Dim smtp As New SmtpClient
smtp.Send(mm)

Catch ex As Exception
errMsg = ex.InnerException.Message
End Try

In the app.config I specified
<system.net>
<mailSettings>
<smtp>
<network host ="myexchangeserveripaddress" />
</smtp>
</mailSettings>
</system.net>

I am running this code on windows vista. I am not sure if that is the issue.
If so how could I resolve that?

Thanks,

What is the problem? You'd get more (and better) assistance if you
specify what your problem is.

--
http://bytes.thinkersroom.com
Oct 18 '07 #3
On Thu, 18 Oct 2007 09:08:02 -0700, Sridhar
<Sr*****@discussions.microsoft.comwrote:
>I put the error message in the subject. This is the detailed error message

System.Net.Mail.SmtpException - Failure sending mail.
InnerException - Unable to connect to Remote server.
No Connection could be made because the target machine actively
refused it.
Ah, I missed that.

With regards to your smtp server, perhaps it requires authentication?

--
http://bytes.thinkersroom.com
Oct 19 '07 #4

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

Similar topics

5
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
22
by: Kristof Thys | last post by:
Hello, I'm developing a C# - windows forms application. To get some information for my application, I'm connecting to an URL, wich gives me XML generated using php. With 90% of the users, this...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
6
by: thinkfr33ly | last post by:
I've been developing on this machine for months and have created many ASP.NET applications that connect to various remote machines, mostly databases. All of a sudden, I am unable to connect to...
6
by: Brad | last post by:
I have a win2003 server workstation with multiple webs, each web has it's own ip address. In VS2005, if I select to open an existing web site, select Local IIS, the dialog correctly displays a...
14
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I...
3
by: Monty | last post by:
OK, I had an issue with this and found lots of advice that did not apply, so I'm posting what I found hoping it might help someone else. Here's the sitch: you have a COM app that calls to a .Net...
0
by: Homer | last post by:
Hi, I got "InnerException: Unable to connect to remote server"..."No connection could be made because the target machine actively refused it" when I attempted to send an email through my...
0
by: =?Utf-8?B?dG9t?= | last post by:
Hi, I have a .net 2.0 windows client that connects to webservices. In most cases it works fine. However I have one client that gets 'Unable to connect to the remote server'. If on that client...
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
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...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.