I'm using MVCMailer for the first time. I have created the mailviewmodel, view and i was able to send the mail successfully.
_myMailer.SendMyMail(mailerModel).Send();
Now I want to catch an exception when email sending is failed. (When no internet connection is available) I tried to use
var client = new SmtpClientWrapper();
client.SendCompleted += (sender, e) =>
{
if (e.Error != null || e.Cancelled)
{
// Handle Error
}
//Use e.UserState
};
which is in GitHub
but this didn't work for me. can anybody please tell me how to achieve this?
Immediate replies appriciated. Thanks