在数据库中记录通知 [英] Log Notification In database

查看:66
本文介绍了在数据库中记录通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿朋友,
我想将邮件通知存储在dot net的数据库中.谁能告诉我该怎么做?

Hey Friends,
I want to store the mail notification in my database in dot net . Can any one tell me how to do it

推荐答案

如果这是您的应用程序,即发送电子邮件,那么您在代码中的某个位置就会看到以下内容:


If this is your application, that is sending emails, then somewhere in your code you have following:


MailMessage mail = new MailMessage();
try{
SmtpClient mail = new SmtpClient("my server");
mail.Send(message);
}
catch(Exception ex)
{
// do what you want with exception (e.g. log it into DB)
}




您可以在此处阅读有关可能引发的异常类型的信息:
邮件.发送例外情况 [




You can read here on type of exceptions that can be thrown:
mail.Send exceptions[^]

Note: This is a pseudo code.


这篇关于在数据库中记录通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆