protected void sendTheEmail_Click(object sender, EventArgs e)
{
jmail.MailMergeClass jmmc = new jmail.MailMergeClass();
jmail.POP3Class jp3 = new jmail.POP3Class();
jmmc.MailTemplate.Charset = "GB2312";
jmmc.MailTemplate.Encoding = "BASE64";
jmmc.MailTemplate.ContentType = "text/html";
jmmc.MailTemplate.ISOEncodeHeaders =false;
jmmc.MailTemplate.Priority = Convert.ToByte(1);
jmmc.MailTemplate.From = SendPeople.Text.Trim();
jmmc.MailTemplate.FromName = sendName.Text.Trim();
jmmc.MailTemplate.Subject = EmailTitle.Text.Trim();
jmmc.MailTemplate.AddRecipient(GetPeople.Text.Trim(),"","");
if ("" != EmaillFileUpload.PostedFile.FileName)
{
string attpath = EmaillFileUpload.PostedFile.FileName;
jmmc.MailTemplate.AddAttachment(@attpath, true, attpath.Substring(attpath.LastIndexOf(".") + 1, 3));//添加附件
jmmc.MailTemplate.Body = EmailMessage.Value.Trim();//邮件内容
if (jmmc.MailTemplate.Send(webServer.Text.Trim(), false))
{
Response.Write("<script>alert('发送成功')</script>");
}
else
{
Response.Write("<script>alert('发送失败')</script>");
}
jmmc = null;
}
}