Monday, June 28, 2010

Send Email from Silverlight application using WCF service

Send email from Silverlight application using WCF service which is hosted on a server.

So, we have 4 main task:
1. Add Silverlight enabled WCF service into your web application project
2. Configure SMTP server
3. Write operation contract in your WCF service which will send email
4. Consume the WCF service in your Silverlight application and invoke to send email as required

Considering you have created a Silverlight application project with a web application project using Visual Studio 2010

Add Silverlight enabled WCF service:
Now create a folder called Service in your WEB application project and add new item


















Now create a class called SLEmailMessage and make it serializable so that this type can be transfer through WCF service:























Now add mail settings in your web.config's configuration section:
















Now write the email sending code in your service class (.svc.cs):
























Now in your Silverlight project add the service reference:


























In your XAML code behind invoke the added service:

























You can download the source.

Friday, June 4, 2010

Silverlight 4 minor update–June 2010

Check here for detail update: http://timheuer.com/blog/archive/2010/06/03/silverlight-4-minor-update-june-2010.aspx

Developer may having problem like below:








In Visual Studion 2010 you may get message 'This page requires a more recent version of Silverlight'

This happened because new Silverlight 4 runtime automatically updated but developer runtime is not updated accordingly.

Solution for the Developer:
*updated developer runtime here: Windows developer runtime or Mac developer runtime. and restart the Visual Studion
*Change the tag to increment the minRuntimeVersion attribute to the appropriate version (4.0.50524.0). 
* If you are using the pulgin down link to specific version then change it