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

Emailing Troubles

Frinavale
9,735 Expert Mod 8TB
Platform: Windows XP Pro
Language: ASP/VB.Net

Hi there,
I am trying to send an email from a remote email server that requires email authentication (requires credentials to log into the webserver in order to send the email).
I have encountered the following error while trying to send an email:

"SocketException (0x274d): No connection could be made because the target machine actively refused it."

The code that generates the error is:

Expand|Select|Wrap|Line Numbers
  1.    Dim retval As Boolean
  2.    retval = False
  3.    Dim emailMessage As Net.Mail.MailMessage
  4.    Dim body As String = compileEmailMessage()
  5.  
  6.    emailMessage = New Net.Mail.MailMessage("FromEmail@email.ca", "ToEmail@email.ca", "Title", body)
  7.  
  8.     Dim mailClient As New Net.Mail.SmtpClient
  9.     Dim myCredentials As New System.Net.NetworkCredential("me@TheMailServer.ca", "******")
  10.  
  11.      mailClient.Host = "mail.MyMailServer.ca"
  12.      mailClient.UseDefaultCredentials = False
  13.      mailClient.Credentials = myCredentials
  14.     Try
  15.           mailClient.Send(emailMessage)  '<-----Crashes on this line
  16.           retval = True
  17.      Catch ex As Exception
  18.            retval = False
  19.           lbl_debug.text = ex.Message + " " + ex.StackTrace
  20.      End Try
  21.  
Has anyone seen this error before or have any comments on how I could fix this error?

Thanks a lot for your help.
-F
Dec 18 '06 #1
2 1986
Frinavale
9,735 Expert Mod 8TB
Platform: Windows XP Pro
Language: ASP/VB.Net

Hi there,
I am trying to send an email from a remote email server that requires email authentication (requires credentials to log into the webserver in order to send the email).
I have encountered the following error while trying to send an email:

"SocketException (0x274d): No connection could be made because the target machine actively refused it."

The code that generates the error is:

Expand|Select|Wrap|Line Numbers
  1.    Dim retval As Boolean
  2.    retval = False
  3.    Dim emailMessage As Net.Mail.MailMessage
  4.    Dim body As String = compileEmailMessage()
  5.  
  6.    emailMessage = New Net.Mail.MailMessage("FromEmail@email.ca", "ToEmail@email.ca", "Title", body)
  7.  
  8.     Dim mailClient As New Net.Mail.SmtpClient
  9.     Dim myCredentials As New System.Net.NetworkCredential("me@TheMailServer.ca", "******")
  10.  
  11.      mailClient.Host = "mail.MyMailServer.ca"
  12.      mailClient.UseDefaultCredentials = False
  13.      mailClient.Credentials = myCredentials
  14.     Try
  15.           mailClient.Send(emailMessage)  '<-----Crashes on this line
  16.           retval = True
  17.      Catch ex As Exception
  18.            retval = False
  19.           lbl_debug.text = ex.Message + " " + ex.StackTrace
  20.      End Try
  21.  
Has anyone seen this error before or have any comments on how I could fix this error?

Thanks a lot for your help.
-F
I figured it out thanks. I found out that the mail server doesn't run on the default port. Once I supplied the port everything worked fine.

:)

-F
Dec 18 '06 #2
sashi
1,754 Expert 1GB
I figured it out thanks. I found out that the mail server doesn't run on the default port. Once I supplied the port everything worked fine.

:)

-F
Hi there,

Congrats on your discovery :) Good luck & Take care.
Dec 19 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stanley Cheung | last post by:
Hi all, I am developing the application for send emailing list, actually, i can perform to send a email 1 by 1 and do it on aspx page. I have a enquiry that how can the application change to...
2
by: Stanley Cheung | last post by:
Hi all, I am developing the application for send emailing list, actually, i can perform to send a email 1 by 1 and do it on aspx page. I have a enquiry that how can the application change to...
3
by: tafs7 | last post by:
My code below is supposed to email me when an error occurs on the application, but it's not emailing anything. Am I missing something? I know the smtp servers I've tried work. I even added a...
4
by: Mike Moore | last post by:
What is the best way to launch outlook from an asp.net web page? Can you do this using MAPI or is there a control that you can purchase? We are unable to use SMTP. We use MS Exhange and MAPI...
1
by: Stanley Cheung | last post by:
Hi all, I am developing the application for send emailing list, actually, i can perform to send a email 1 by 1 and do it on aspx page. I have a enquiry that how can the application change to...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.