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.

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

Thanks.,
Dragonbaki.

Be a part of the DaniWeb community

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