user601367
user601367

Reputation: 2378

how to send mail using handler?

i want to send mail so i wrote one method in handler.ashx but i got error as

The "SendUsing" configuration value is invalid. what does it mean pls help me

public bool Sendmail() { bool strResult = false; try {

        email.Subject = " Registration";

        email.To = "[email protected]";
        email.From = "[email protected]";
        email.Cc = "[email protected]";
        email.Bcc = "[email protected]";
        email.BodyFormat = MailFormat.Html;

        email.Body = "<html>" +
                       "<body>" +
                      "<b>Hi ravi</b>"+
                       "</body>" +
                       "</html>";
        email.Priority = MailPriority.Normal;


       SmtpMail.Send(email);
        strResult = true;
    }
    catch (Exception ex)
    {
        //FTEHelper.SendEmail("[email protected]", "Ticket Upload Batch Error",
        //   ex.ToString());


        strResult = false;

    }


    return strResult;





}

Upvotes: 0

Views: 683

Answers (1)

Dmitry
Dmitry

Reputation: 3107

You should specify an SMTP server.

SmtpMail.SmtpServer = "yourservername";

Also you should consider using System.Net.Mail namespace instead of System.Web.Mail. (If you aren't forced to use .NET 1, of course.)

Upvotes: 1

Related Questions