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;

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;
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..:(


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

Nobody can answer it uhh..?

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..


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.