Click here to Skip to main content
13,353,462 members (66,111 online)
Click here to Skip to main content
Add your own
alternative version


2 bookmarked
Posted 27 Mar 2012

Sent Email (Yahoo! SMTP) with Silverlight 5 WCF RIA

, 27 Mar 2012
Rate this:
Please Sign up or sign in to vote.
How to sent email (Yahoo! SMTP) with Silverlight 5 WCF RIA.


I just want to share my own code to sent emails in Silverlight 5. I hope it can help other developers to sent emails easily.

Using the code

I will go straight to the code. Just include this code in your Web Services:

public partial class GeneralDomainService : LinqToSqlDomainService<BabyPinkMallLinqDataContext>
    public void SendEmail(string subject, string text, string toAddress, string fromAddress)
        MailMessage message = new MailMessage();
        SmtpClient server = new SmtpClient("",587);
        server.EnableSsl = false;
        server.UseDefaultCredentials = false;
        server.Credentials = 
          new NetworkCredential("", "yourpassword");
        message.From = new MailAddress(fromAddress);
        message.Subject = subject;
        message.Body = text;
        message.IsBodyHtml = true;
        message.To.Add(new MailAddress(toAddress));
        server.Timeout = 5000;

and you can call it from your view like this:

YourDomainContext.SendEmail("Subject", "textBody", "ToAddress", "fromAddress");

Points of Interest

I used Invoke as an attribute because this method doesn't need any result. Just sent an e-mail to your customer.(^o^)v

*I'm so sorry if my writing isn't very good. This is my first time sharing code. Thanks.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
Indonesia Indonesia
This member doesn't quite have enough reputation to be able to display their biography and homepage.

You may also be interested in...

Comments and Discussions

QuestionCan you give me a sample project? Pin
memberPEIYANGXINQU8-Sep-12 7:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 27 Mar 2012
Article Copyright 2012 by Kortez2223
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid