关于我的项目的邮件代码逻辑 [英] mail code logic regarding my project
本文介绍了关于我的项目的邮件代码逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
在我的项目中,我需要一个帮助.请提出建议.
项目包含所有员工信息页面,即个人,紧急情况,技能,工作经验等.
我需要做的是,如果有任何员工更新该页面中的任何数据,邮件都应该触发给我的人力资源经理.我需要以哪种方式编写逻辑.
请帮我. :)
hi all,
in my project i need one help.please suggest me.
project contains all the employee information pages i.e personal,emergency,skills,work experience etc....
what i need to do is if any employee updates any data in that pages mail should be triggered to my hr manager.in what way i need to write the logic.
please do help me. :)
推荐答案
创建一种向hr发送电子邮件的方法,其中包含具有更新的员工详细信息.
在每个页面中调用它以获取员工进行的更新.
[更新]
在ASP.Net中发送电子邮件 [
Create a method to send email to hr with Employees details who have updates.
Call that in every page for updates made by the employees.
[Update]
Send Email in ASP.Net[^]
For suppose you are updating the employee contact details
private void btnUpdate_Click(object sender, System.EventArgs e)
{
//code to update your employees details.
// call the sendemail() here
SendEmail();
}
public void SendEmail()
{
//code to send email.
}
[/Update]
[/Update]
您可以使用它
You can use it
public static class MailUtility
{
public static void SendEmail(string sender, string receiver, string subject, string body)
{
MailMessage message = new MailMessage();
message.From = new System.Net.Mail.MailAddress(sender, "ADMIN");
message.To.Add(receiver);
message.IsBodyHtml = true;
message.Body = body;
message.Subject = subject;
SmtpClient smtp = new SmtpClient();
try
{
smtp.Send(message);
}
catch (Exception)
{
}
message = null;
}
}
这篇关于关于我的项目的邮件代码逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文