我曾经在asp.net 中发送电子邮件(使用 c# 代码) ,我曾经在 aspx 页面中设计表单并在 aspx.cs 页面中编写代码,例如
string mailto;
string mailfrom;
string name;
string subject;
string message;
string MailContent;
string cc;
SmtpClient client;
System.Net.Mail.MailMessage msg;
client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("noreply@gmail.com", "password");
client.Port = 587;//25
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
mailto ="abc@gmail.com";
mailfrom = "noreply@gmail.com";
name = "name";
subject = "subject";
message ="hi";
msg = new System.Net.Mail.MailMessage();
msg.To.Add(mailto);
//msg.To.Add(cc);
msg.From = new MailAddress(mailfrom, name, System.Text.Encoding.UTF8);
msg.Subject = subject;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = message;
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
try
{
client.Send(msg);
MailStatus = true;
}
catch (Exception ex)
{
ex.ToString();
MailStatus = false;
}
但是我想从简单的.html 页面发送邮件,就像上面在.aspx 页面中所做的那样?是否有任何类型的javascript或css或dll文件可用于发送电子邮件?