razor - 剃须刀网页上的 SMTP
问题描述
我正在为网页编写剃刀语法。我的问题是我有一个包含员工电子邮件地址的表格,我想在从表单字段中单击他们的任何姓名后向他们发送电子邮件。
这是我到目前为止所尝试的:
// Initialize WebMail helper
WebMail.SmtpServer = "smtp.office365.com";
WebMail.SmtpPort = 25;
WebMail.UserName = "";
WebMail.Password = "";
WebMail.From = "";
WebMail.EnableSsl = true;
//i want to send a message to an email
WebMail.Send(to: Email,
subject: "Visitor Alert",
body: " From: <br/> " + "Name: " + full_name + "<br/> " + " Mobile Number: "
+ phone_number + "<br/> " + " Address :" + address);
//this is html part
<div class="form-group">
@{
var data = "SELECT FullName,Email From Employee ORDER BY Email";
var DB = Database.Open("VisitorConnectionString").Query(data);
<label>Whom to See</label>
<select class="form-control">
<option>---Select Staff---</option>
//here was to populate the name of the employees from database
@foreach (var item in DB)
{
<option name="Email" value="@item.FullName">@item.FUllName</option>
}
</select>
}
解决方案
我已经想通了,写了一个 sql 语句从数据库中获取电子邮件,然后将它与下拉列表一起循环。谢谢。
推荐阅读
- javascript - Gulp Static i18n:href 插值不起作用
- bash - 如何在 unix 脚本中提取文件名的一部分并检查它是否存在
- javascript - 使用
标签为什么这里的监督变得如此琐碎,自以为是,肛门,无情和被动攻击?这是一个代码论坛。顺便说一句 -1
- swift - 将 UIBezierPath 转换为 PKStrokePath swift
- java - (不是 Recuisive)在 android java 中获取列表文件类型
- c# - FileSystemWatcher:将多个过滤器事件聚合成一个?
- python - Seaborn regplot:IndexError:数组索引过多
- java - Spring - 测试多线程问题
- c - 提高无损音频编码算法中位复制的速度(用 C 编写)
- mysql - 嘿!我无法使用 NodeJS 将 html 表单数据插入 MySQL 数据库