472,806 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,806 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 1977
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?

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.