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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:24:38+00:00 2026-05-31T18:24:38+00:00

Problem: Have made a small mail program which works perfectly on my developer pc

  • 0

Problem: Have made a small mail program which works perfectly on my developer pc but when put into production it fails.

protected void Page_Load(object sender, EventArgs e)
{
    string smtpHost = ConfigurationManager.AppSettings["SmtpAddress"];
    MailMessage mail = new MailMessage();
    mail.From = new MailAddress(ConfigurationManager.AppSettings["FromMailAddress"]);
    mail.Sender = new MailAddress(ConfigurationManager.AppSettings["FromMailAddress"]);
    mail.To.Add(new MailAddress("zzz@xxx.yy"));
    mail.Subject = "Test mail";
    mail.Body = string.Format("Is this mail sent via {0} ?", smtpHost);

    lblMsg2.Text = string.Format("SmtpHost: {0}", smtpHost); ;

    SmtpClient client = new SmtpClient(smtpHost);
    try
    {
        client.Send(mail);
    }
    catch (Exception exception)
    {
        lblMsg3.Text = exception.Message.ToString();
        lblMsg4.Text = exception.InnerException.ToString();
    }
}

I do get the correct mail address and everything on the production server, but nothing ends in my email inbox :-(. I do not receive any exceptions.

I have tried using telnet on the same server and from there I am able to send mails.

I have tried installing WireShark which is looking at the network card on the server and when using telnet I do get the reponse I suspected, but from my program I do not receive anything.

Edited 2012-03-12 @ 09:46 danish time

Have now updated the code to look like this

protected void Page_Load(object sender, EventArgs e) 
{ 
    string smtpHost = ConfigurationManager.AppSettings["SmtpAddress"]; 
    MailMessage mail = new MailMessage(); 
    mail.From = new MailAddress(ConfigurationManager.AppSettings["FromMailAddress"]); 
    mail.Sender = new MailAddress(ConfigurationManager.AppSettings["FromMailAddress"]); 
    mail.To.Add(new MailAddress("zzz@xxx.yy")); 
    mail.Subject = "Test mail"; 
    mail.Body = string.Format("Is this mail sent via {0} ?", smtpHost); 

    lblMsg2.Text = string.Format("SmtpHost: {0}", smtpHost); ; 

    SmtpClient client = new SmtpClient(smtpHost); 

    client.Send(mail); 
} 

And quite interesting: Even when inserting an SMTP-server that does definately not exist, I still do not get any errors on my production environment. I do get an exception on my developer pc which basically means that the smtp-server does not exist (which I also expected to get a message about).

  • 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-31T18:24:39+00:00Added an answer on May 31, 2026 at 6:24 pm

    Case solved 🙂

    And I learned more about IIS!

    The IIS was set up to “Store e-mail in Pickup directory” instead of “Deliver e-mail to SMTP server”. Unfortunately I am not that good at IIS and I did not know that there was a setting like that… I am now!

    The “double check you configuration settings” from @GarryM was unfortunately not enough for me or my mail-administrator to make us look at the IIS. I am too much a programmer and my mail-adm is too much a network guy 🙂

    Thank you everyone for your answers. It was partly because of all your good hints and ideas that I could leave out more and more parts.

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

Sidebar

Related Questions

I have made a swings application but there is one problem in that which
I have made a small JS fiddle to demonstrate my problem. When you zoom
I have made a small function which should print some InfoPath files. It is
I made this small Java program using eclipse IDE. I have set the workspace
I am having some issues with a small program I have made that edits
I have a small problem but couldn't find solution for that. I have founded
I have made a very simple AppleScript to close tabs in Safari. The problem
Here's my problem: I have an unmanaged dll that I made.I'm calling one of
I have a problem with a javascript set of functions that I made. This
We have a website made by Django. And there is no problem when access

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.