razor网页上的SMTP

razor网页上的SMTP,razor,Razor,我正在为网页编写razor语法。我的问题是,我有一个包含员工电子邮件地址的表,我想在单击表单字段中的任何姓名后向他们发送电子邮件 以下是我迄今为止所尝试的: // Initialize WebMail helper WebMail.SmtpServer = "smtp.office365.com"; WebMail.SmtpPort = 25; WebMail.UserName = ""; WebMail.Password = ""

我正在为网页编写razor语法。我的问题是,我有一个包含员工电子邮件地址的表,我想在单击表单字段中的任何姓名后向他们发送电子邮件

以下是我迄今为止所尝试的:

// 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语句从数据库中提取电子邮件, 然后将其与下拉列表循环在一起。 谢谢