0

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.

1
Contributor
3
Replies
4
Views
6 Years
Discussion Span
Last Post by Dragonbaki
0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.