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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:19:27+00:00 2026-06-14T23:19:27+00:00

Updated for bounty. What I am after is a simple way to send e-mail

  • 0

Updated for bounty. What I am after is a simple way to send e-mail when I click a button on one of my LightSwitch Screens. I need to be able to access data from any screen (to collect and process it) so it can be sent as an e-mail. How can this be done without breaking my back over it, or using any third party components or services? Third party stuff isn’t an option in this case.


I have followed every tutorial I could find, and it just doesn’t work. I cannot send an email to someone from a LightSwitch application, no matter how I do it. I can send email from WinForms, WPF, Websites – so I know it’s not my code that’s the problem.

I have followed this tutorial to a “T”, and (http://blogs.msdn.com/b/bethmassi/archive/2011/01/27/how-to-send-html-email-from-a-lightswitch-application.aspx) it still won’t work. First, here are my current issues:

  1. In this tutorial, it tells you to add your Class.cs file to the UserCode folder in the Server folder – I did that.
  2. It also tells you to Add a reference to System.Net.Mail (obviously) – I tried that. System.Net.Mail is not available to be added. I can’t find it anywhere!
  3. Every other tutorial is the same – so there’s nothing else that I can try, that I know of.

As you can see below, I try adding System.Net.Mail as a reference, but it’s not there in the list. I’ve also tried adding the using System.Net.Mail to the top of the files, but like I said; it’s not available/does not exist/whatever.

enter image description here

Anyone know how to send email from a LightSwitch application?

Note, this is not a service, or website type project, just a simple Desktop Lightswitch app.

I have an invoice management app that I’m making, and the only part left is to auto-send a payment due reminder email if the payment is way overdue, based on the DateDue value in the table.

I’ve seen other comments on MSDN forums by people who said that System.Net.Mail is not available in Silverlight, and that’s why it’s not there in LightSwitch. I don’t know if that’s true or not, but it certainly is looking that way. Why couldn’t they have just made System.Net.Mail available for LightSwitch apps without making us jump through hoops just to get it working?

Even though I said I know my code is fine, I’ll post it anyway.

C#: (Note that in my CLASS file System.Net.Mail IS available HOWEVER, I am not able to access any part of this code in this file from anywhere else or any other file in my entire project!)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;

namespace LightSwitchApplication
{
    public class JTS
    {
        public class Mail
        {
            public string recipient { get; set; }
            public string subject { get; set; }
            public string message { get; set; }

            public void Send()
            {
                using (MailMessage mailmessage = new MailMessage())
                {
                    mailmessage.From = new MailAddress("@.com");
                    mailmessage.To.Add(recipient);
                    mailmessage.Subject = subject;
                    mailmessage.Body = message;
                    mailmessage.Priority = MailPriority.High;

                    using (SmtpClient client = new SmtpClient())
                    {
                        client.Credentials = new System.Net.NetworkCredential("@.com", "_SVN");
                        client.EnableSsl = false;
                        client.Host = "m..com";
                        client.Port = 25;
                        client.Send(mailmessage);
                    }
                }
            }
        }
    }
}
  • 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-14T23:19:29+00:00Added an answer on June 14, 2026 at 11:19 pm

    System.Net.Mail is a namespace, not an assembly. Try adding a reference to System.Net to see if that helps.

    That tutorial you mentioned references
    this one, where it is System.Net they are adding the reference to.

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

Sidebar

Related Questions

Question Updated for Bounty In Flash I need to load a dynamically generated XML
Updated Example: http://jsfiddle.net/7Cwbn/62/ You can click on the markers Hold Ctrl to select multiple
UPDATED: Added one more question (Question #4). Hi all, I'm building myself a custom
UPDATED See post #3 below. There is a need to upload a file to
Update after Bounty was awarded A new solution is coming up to this problem.
Bounty open: Ok people, the boss needs an answer and I need a pay
After asking this question I realized that to build what I need I'd better
Updated-2 I have interesting combination of warnings & errors. Firstly, when debugging, i get
UPDATED: I am setting default scope for some models in a runtime which seems
[Updated with partial answers, some more detailed questions.] Does CouchDB support multi-domain hosting? Yes,

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.