views:

34

answers:

0

Hi Experts,

I am trying to send a mail (Forgot password) to the client using ajax pro. so when the control enters the function and creates the object MailMessage mm = new MailMessage(ConfigurationService.GetFromEmailAddress(), To); , it fails. but works otherwise. It also works when I use system.web.mail.

Is there any particular reason why its not working.

Regards Parminder

public static void SendPasswordReminderEmail(string To, string Password) {

        MailMessage mm = new MailMessage(ConfigurationService.GetFromEmailAddress(), To);
        EmailTemplate emailTemplate = EmailTemplateService.GetForgotPasswordTemplate();

        mm.Subject = emailTemplate.Subject
                    .Replace("{SiteName}", ConfigurationService.GetSiteName());
        mm.Body = emailTemplate.Body
                    .Replace("{Password}", Password);
        mm.IsBodyHtml = true;

        Send(mm);
    }