Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8281285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:58:38+00:00 2026-06-08T09:58:38+00:00

I am trying to use System.Net.Mail for an application to send an email, but

  • 0

I am trying to use System.Net.Mail for an application to send an email, but get this exception:

System.Net.Mail.SmtpException: Failure sending mail. —>
System.Net.WebException: Unable to connect to the remote server —>
System.Net.Sockets.SocketException: No connection could be made
because the target machine actively refused it 198.238.39.170:25

The code I am using is:

string mailserver = "Scanmail.ofm.wa.lcl";
MailMessage msg = new MailMessage("albert@einstein.net", "snark@snarky.com", "Very subjective", "A message body!");
SmtpClient client = new SmtpClient(mailserver);
client.Send(msg);

Obviously the email addresses above are fictional, but in the actual code it uses real email addresses in the system. The mail server address is accurate.

I am tempted to think that I need to put some kind of security credentials in there, but not sure where – although @Andre_Calil’s advice suggests this is not the problem, and that possibly the mail server is configured to prevent my development machine from connecting. So how is this to be overcome?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:58:40+00:00Added an answer on June 8, 2026 at 9:58 am

    So, as we were talking, your server is probably configured to deny relay from every machine, which is a recommended security setting.

    From your development machine, open a prompt (command) and type telnet SMTP_SERVER_IP_ADDRESS 25. This command will try to establish a basic socket connection on port 25, which is the default SMTP port. If it’s successful, you’ll still have to discover whether the server requires authentication.

    However, if it’s unsuccessful, you’ll have to put your code on hold until you can get the help of a sysadmin.

    One other thing to try is to repeat this same test from a app server, because the SMTP server may be configured to allow app_server and deny everybody_else.

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the System.Net.Mail.MailMessage class in C# to create an email
Im trying to send a mail from a asp.net script, but im getting this
I'm trying to use the code below to send messages via System.Net.Mail and am
I am trying to use System.Net.WebClient in a WinForms application to upload a file
I'm trying to use System.Windows.Forms.HTMLDocument in a console application. First, is this even possible?
I'm trying to figure out how to use the System.Net.WebRequest class to send my
I'm trying to send a simple plain-text email through my VB.net web application. I've
I am trying to use the below code to send email from asp.net(C#). using
I'm trying to send an email from a system which is trying to use
In .net frameworks 1.1, I use System.Configuration.ConfigurationSettings.AppSettings[name]; for application settings. But in .Net 2.0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.