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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:38:12+00:00 2026-05-27T04:38:12+00:00

For my silverlight project I’m creating a newsletter which can be send through a

  • 0

For my silverlight project I’m creating a newsletter which can be send through a certain page.

For this I have a newsletter service which can be seen here:

       public bool SendMail(string emailTo, string emailFrom, string msgSubject, string msgBody)
    {
        bool success = false;
        try
        {
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress(emailFrom);
            msg.To.Add(new MailAddress(emailTo));
            msg.Subject = msgSubject;
            msg.Body = msgBody;
            msg.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com"; // Replace with your servers IP address
            smtp.Port = 465;
            smtp.EnableSsl = false;
            smtp.Send(msg);
            success = true;
        }

        catch(Exception e)
        {
            success = false;
        }

        return success;

    }

And I ask the service to send the mail with the following code:

   public partial class Nieuwsbrief : UserControl
{
    IEnumerable<Inschrijvingen> ingeschrevenen = null;

    public Nieuwsbrief()
    {
        InschrijvingenServiceClient personclient = new InschrijvingenServiceClient();

        personclient.getInschrijvingenCompleted += new EventHandler<getInschrijvingenCompletedEventArgs>(personclient_getInschrijvingenCompleted);
        personclient.getInschrijvingenAsync();

        InitializeComponent();
    }

    private void btnSubmit_Click(object sender, RoutedEventArgs e)
    {
        NieuwsbriefServiceClient client = new NieuwsbriefServiceClient();

        //foreach (Inschrijvingen person in ingeschrevenen)
        //{
            client.SendMailAsync("test@gmail.com", "nieuwsbrief@ondernemersaward.be", txtSubject.Text, txtContent.Text);
        //}

        client.SendMailCompleted += new EventHandler<SendMailCompletedEventArgs>(client_SendMailCompleted);
    }

    void personclient_getInschrijvingenCompleted(object sender, getInschrijvingenCompletedEventArgs e)
    {
        ingeschrevenen = e.Result;
    }

    void client_SendMailCompleted(object sender, SendMailCompletedEventArgs e)
    {
        if (e.Error != null)
            txtContent.Text = "Mail has NOT send!" + e.Error.ToString();
        else
            MessageBox.Show(e.Result.ToString());
    }
}

However when I press btnSubmit nothing happens, untill I shut down the server and then I get the following error:

Mail has NOT send!System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
   at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
   --- End of inner exception stack trace ---
   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
   at OndernemersAward.NieuwsbriefServiceReference.NieuwsbriefServiceClient.NieuwsbriefServiceClientChannel.EndSendMail(IAsyncResult result)
   at OndernemersAward.NieuwsbriefServiceReference.NieuwsbriefServiceClient.OndernemersAward.NieuwsbriefServiceReference.NieuwsbriefService.EndSendMail(IAsyncResult result)
   at OndernemersAward.NieuwsbriefServiceReference.NieuwsbriefServiceClient.OnEndSendMail(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

I hope somebody can help me,
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-27T04:38:13+00:00Added an answer on May 27, 2026 at 4:38 am

    In your catch statement do this:

    catch (Exception e)
    {   //<---- Put the break point here.
    
    }
    

    You can then see ‘e’ and see why this is failing.

    My guess is that it’s smtp.Send that’s failing, and it can throw a lot of exceptions, so I won’t venture to guess which one!

    EDIT: Also, where it says “// Replace with your servers IP address”, did you replace it with your server’s IP address? I first assumed you posted demo code, but I want to be sure.

    Well, this is your problem! Gmail lets you use them as an smtp server. Use them: http://www.geekzone.co.nz/tonyhughes/599. You have to change your smtp.Port to 465 and the smtp.Host to smtp.gmail.com. This requires authentication, so go create a gmail account.

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

Sidebar

Related Questions

I have a Silverlight project which takes some encrypted string thru its Service Reference:
I have a Silverlight project (in VB), which uses a (WCF RIA) Domain Service,
I have a Silverlight Project which passes data using the Data Contract to a
I have a Silverlight project that uses a WCF service that I created. My
I have a Silverlight project in which I compile to both Silverlight 2 and
How we can add the silverlight project into a aspx page. I had created
I have created a RIA DataDomainService which I exposed to my silverlight project. The
I have this problem in this scenario: 1-I made a new silverlight project with
I have a common silverlight project. This project project, among other things, includes constants
I have a silverlight project which contains 2 silverlight controls Control_1 and Control_2. Please

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.