954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Unable to send mail In silverlight

Hi experts.,:)

I have tried to send mail using silverlight application and now i am very much tired because of can't get it correctly.... I wrote a Web Service for sending mail as like below.

using System.Web.Mail;


MailMessage msg = new MailMessage();
msg.From = emailFrom;
msg.To = emailTo;
msg.Subject = msgSubject;
msg.Body = msgBody;
msg.Priority = MailPriority.High;

SmtpMail.Send(msg);
success = true;


This works perfectly in Localhost. But in IIS, No error has been shown and No mail has been sent.:'( Can anybody justify about what may be wrong..?

And, additionally i tried the alternative too...

using System.Net.Mail;

MailMessage message = new MailMessage(emailFrom, emailTo);
message.Subject = msgSubject;
message.Body = msgBody;
message.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtp.Send(message);
success = true;


This also working fine in localhost. But in IIS, the same issue i get. What may be the problem.? Please help me to solve this issue..:(

Regards,
Dragon.

Dragonbaki
Junior Poster
130 posts since Oct 2010
Reputation Points: 15
Solved Threads: 21
 

Nobody there to help me out.....? :-(

Dragonbaki
Junior Poster
130 posts since Oct 2010
Reputation Points: 15
Solved Threads: 21
 

Nobody can answer it uhh..?

Dragonbaki
Junior Poster
130 posts since Oct 2010
Reputation Points: 15
Solved Threads: 21
 

After a long struggle, I found out the solution.. Here it is.,

In ServiceRefernce.ClientConfig file located at silverlight project ( not in web project ), endpoint address has the localhost webservice reference url. So only it works better in Localhost.,

But coming to IIS, the same reference will not work. For that, we need to run the webservice in IIS first, get the URL of webservice and paste the url in the endpoint address of ServiceReferences.ClientConfig file. Thereafter, if we take setup and host in IIS means, it will works perfectly..

Thanks.,
Dragonbaki.

Dragonbaki
Junior Poster
130 posts since Oct 2010
Reputation Points: 15
Solved Threads: 21
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: