本文整理汇总了C#中IEmailSender.Send方法的典型用法代码示例。如果您正苦于以下问题:C# IEmailSender.Send方法的具体用法?C# IEmailSender.Send怎么用?C# IEmailSender.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEmailSender
的用法示例。
在下文中一共展示了IEmailSender.Send方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendTaskAssignedEmail
public static void SendTaskAssignedEmail(TaskAssignedEmailViewModel viewModel, IEmailSender emailSender, bool isActionTask = false)
{
var email = (isActionTask) ?
new MailerController().ActionTaskAssigned(viewModel) :
new MailerController().TaskAssigned(viewModel);
emailSender.Send(email);
}
示例2: SendXmlMailUsingStringTemplateFormatter
/// <summary>
/// Sends the XML mail using string template formatter.
/// </summary>
/// <param name="xmlTemplate">The XML template.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="sender">The sender.</param>
public static void SendXmlMailUsingStringTemplateFormatter(XmlDocument xmlTemplate, ParameterCollection parameters, IEmailSender sender)
{
EmailTemplate template = new XmlEmailTemplate(xmlTemplate);
IEmailFormatter formatter = new StringTemplateEmailFormatter();
sender.Send(template, formatter, parameters);
}
示例3: SendXmlMail
/// <summary>
/// Sends the XML mail.
/// </summary>
/// <param name="xmlTemplateFileName">Name of the XML template file.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="sender">The sender.</param>
public static void SendXmlMail(string xmlTemplateFileName, ParameterCollection parameters, IEmailSender sender)
{
EmailTemplate template = new XmlEmailTemplate(xmlTemplateFileName);
IEmailFormatter formatter = new XmlTemplateEmailFormatter();
sender.Send(template, formatter, parameters);
}
示例4: DoWork
public void DoWork(IlluminateDatabase database,IEmailSender emailSender)
{
Logger.Information("EmailDailyTasks started");
//we need to get a list of tasks that are Overdue, duetoday or due tomorrow.
foreach (var db in database.GetAllOrgStores())
{
Currentstore = db;
List<User> users;
using (var session = db.OpenSession())
{
users = session.Query<User>().ToList();
}
//get the tasks etc for this user.
foreach (var user in users)
{
Currentuser = user;
//set culture
Thread.CurrentThread.CurrentCulture = user.Culture;
var bodyBuilder = new StringBuilder();
using (var session = db.OpenSession()) //smaller sessions
{
var targetuser = user;
var tasks =
session.Query<Task>()
.Where(
x =>
x.ConsolidatedAssignees.Any(a => a.UserId == targetuser.Id) &&
x.DueDate <= DateTime.Today.AddDays(3) && x.CompletedDate == null);
var meetings =
session.Query<Meeting>()
.Where(
x =>
x.Invitees.Any(i => i.UserId == targetuser.Id) &&
x.DueDate <= DateTime.Today.AddDays(3) &&
x.DueDate >= DateTime.Today);
var items = new List<TimelineItem>();
items.AddRange(tasks.ToList().ToTimelineItems());
items.AddRange(meetings.ToList().ToTimelineItems());
Logger.Information("{0} items for {1}", items.Count, targetuser.Name);
var sectionbuilder = new StringBuilder();
if (items.Count > 0)
{
var overduelines =
(from i in items
where i.start.Date < DateTime.Today
orderby i.start ascending
select FormatItem(i));
sectionbuilder.AppendLine(SubHeader("Overdue tasks"));
if (overduelines.Any())
{
sectionbuilder.Append(String.Join("\n", overduelines.ToList()));
}
else
{
sectionbuilder.AppendLine("No items to show<br/>");
}
sectionbuilder.AppendLine("<br/>");
var todaylines =
(from i in items
where i.start.Date == DateTime.Today
orderby i.start ascending
select FormatItem(i));
sectionbuilder.AppendLine(SubHeader("Today's tasks"));
if (todaylines.Any())
{
sectionbuilder.Append(String.Join("\n", todaylines.ToList()));
}
else
{
sectionbuilder.AppendLine("No items to show<br/>");
}
sectionbuilder.AppendLine("<br/>");
//.........这里部分代码省略.........
示例5: SendReviewAssignedEmail
public static void SendReviewAssignedEmail(ReviewAssignedEmailViewModel viewModel, IEmailSender emailSender)
{
var email = new MailerController().ReviewAssigned(viewModel);
emailSender.Send(email);
}