本文整理汇总了C#中IEmailSender.SendMail方法的典型用法代码示例。如果您正苦于以下问题:C# IEmailSender.SendMail方法的具体用法?C# IEmailSender.SendMail怎么用?C# IEmailSender.SendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEmailSender
的用法示例。
在下文中一共展示了IEmailSender.SendMail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendInvitation
//Add an entry in the ACL, and send an invitation email
public void SendInvitation(string email, Guid ProjectID, UserType userType, IEmailSender emailSender)
{
//Database access
var db = new ApplicationDBContext();
//make sure this isnt a duplicate
if (db.UsersAccessProjects.Where(acl => acl.Email == email && acl.ProjectID == ProjectID).Count() == 0)
{
//Working with ACL
var acl = new UsersAccessProjects();
acl.Email = email;
acl.invitationAccepted = false;
acl.ProjectID = ProjectID;
acl.UserID = null;
//Save the ACL entry
db.UsersAccessProjects.Add(acl);
db.SaveChanges();
//build an invitaion email
string body;
body = "You have been invited to a new project.\n";
body += "Click the link to accept the invitation.\n";
body += "http://northcarolinataxrecoverycalculator.apphb.com/Project/AcceptInvite/" + acl.ID;
//send an invitaion email
emailSender.SendMail(email, "You have been invited to a project", body);
}
}
示例2: SendInvitation
/// <summary>
/// Send an invition via email to the invited user to collaborate on a project
/// </summary>
/// <param name="acl"></param>
/// <param name="emailSender"></param>
public void SendInvitation(UsersAccessProjects acl, IEmailSender emailSender)
{
//build an invitaion email. this is dirty :(
string body;
body = "You have been invited to a new project.\n";
body += "Click the link to accept the invitation.\n";
body += "http://northcarolinataxrecoverycalculator.apphb.com/Project/AcceptInvite/" + acl.ID;
//send an invitaion email
emailSender.SendMail(acl.Email, "You have been invited to a project", body);
}