anbu210
asked on
Send Email Functionality in Silverlight with body in HTML Format
I am using a Silverlight Application, Which contains several tab and each tab contains Datagrid.
List<DataGrid> dtgrdCollection = new List<DataGrid>();
using above code + my additional functionality I have collected all datagrid as list array.
I have a Child window, which has few input fields like Recipient's Email address, Subject line, Personalized Message(body of email) and send Message,
I need a code snippet where I will pass my datagrid collection to SendEmail function in Childwindow...
and a SendEmail function which accepts input parameters and sends email to the recipient.
note that the Body of email should have all the datagrids values in a rows\column format one below the other with title header of each grids as datagrid.tag value.
Any help to start with would be appreciated. Kindly help me..
List<DataGrid> dtgrdCollection = new List<DataGrid>();
using above code + my additional functionality I have collected all datagrid as list array.
I have a Child window, which has few input fields like Recipient's Email address, Subject line, Personalized Message(body of email) and send Message,
I need a code snippet where I will pass my datagrid collection to SendEmail function in Childwindow...
and a SendEmail function which accepts input parameters and sends email to the recipient.
note that the Body of email should have all the datagrids values in a rows\column format one below the other with title header of each grids as datagrid.tag value.
Any help to start with would be appreciated. Kindly help me..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Gautham Janardhan....The code looks good....I am already using WCF RIA services in my Silverlight application. Should I need to create a new WCF service or include the code in same WCF RIA services..?
@apeter : Link is not visible, could you re-post the sample ?
@apeter : Link is not visible, could you re-post the sample ?
you can use the same one
ASKER
Thanks Gautham ....I used in my Silverlight WCF RIA services and used onlinedomainContext to call it...
It worked with test email...
Now only pending item is how to generate html from the datagridcollection list and then pass it as body of message.
Any ideas on this ?
It worked with test email...
Now only pending item is how to generate html from the datagridcollection list and then pass it as body of message.
Any ideas on this ?
http://bronsblog.com/post/2011/07/05/Send-an-email-with-Silverlight-4.aspx link is working for me. Just checked.
like apeter said you could generate the xml and then use XSLT to generate HTML file.
ASKER
Finally it worked, I directly wrote a class file which takes input as Collection of Datagrid List and returns me string in HTML format (which contains data in table format) with some color, width formatting etc..
then I need to set as below, before setting body of the email....
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;
then I need to set as below, before setting body of the email....
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;
ASKER
Send email functionality worked as mentioned in the link.
ASKER
@Gautham Janardhan, It works fine when running in VS2012 or deploying in local machine IIS. However when deployed to test server (WIN server 2008 R2) getting an exception "Unable to connect to remote server"
I have created new thread here : http://www.experts-exchang e.com/Prog ramming/La nguages/C_ Sharp/Q_28 475919.htm l
Please let me now if u have suggestions
I have created new thread here : http://www.experts-exchang
Please let me now if u have suggestions
sample can be found here for xslt.