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 7083867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:13:53+00:00 2026-05-28T07:13:53+00:00

I have a C# services checker program. The exe is kicked off from a

  • 0

I have a C# services checker program. The exe is kicked off from a bat file which also passes in a number of arguments (e.g an int count of how many services you want to check, string of the service display name) and also emailTo, emailFrom, emailServer, etc as if a service is not running a email will be sent. This is the code for the email part:

MailMessage mail = new MailMessage(emailFrom, emailTo);
SmtpClient SMTP = new SmtpClient(emailServer);
if (emailUser != "")
{
    SMTP.Credentials = new NetworkCredential(emailUser, emailPass);
}
mail.Subject = "The " + service + " service has stopped running";
mail.Body = "Please take a look into the " + 
            service + " service and think about restarting.";

SMTP.Send(mail);

So on one server I use emailServer as “localhost” passed in, in the bat file and when it runs if a service that I am checking is not running then the email is sent fine and everything is working. However on a different server I again use “localhost” as my emailServer but when I run the bat file. I get an error System.Net.Mail.Smtp.Exception [8012], and the email is not sent. Is this something that is not set up on the server rather than the program that is causing my issue (server config isnt my strong area).

Thanks.

  • 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-05-28T07:13:53+00:00Added an answer on May 28, 2026 at 7:13 am

    Is there an e-mail server running on the server where your program fails? You are trying to send e-mail to localhost (i.e. the computer where your program is executed). If SMTP port 25 is not responding on that machine your e-mail will not be delivered.

    For emailServer you have to supply the host name of the computer in your network that is able to accept and handle e-mail. Normally you would not use localhost for the name of that computer.

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

Sidebar

Related Questions

I have a web application which passes an authentication key to web services for
I have a program which uses an io_service and several threads. It instantiates some
We have a use case to: start a java program from another java program.
I have Reporting Services set up with Forms Authentication. Our app is sitting over
I have two Services called TemplateService, TemplateReportService (both defined in one WCF Service Library)
Various online services have different values for maximum year of expiry, when it comes
I have found services like ClearSpring and Widgetbox for putting content snippets onto a
I have two services, one that calls another. Both are marked as singletons as
Suppose I have several services represented by classes ServiceA, ServiceB, ServiceC etc. These services
One of the tenets of SOA is: Services Are Autonomous. I have 2 services.

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.