噢!代码如下
string str="文本格式";
MailMessage MyMsg = new MailMessage();
MyMsg.From = Tbfrom.Text;
MyMsg.To = Tbto.Text;
MyMsg.Cc = "";
MyMsg.Bcc = "";
MyMsg.Subject = Tbsubject.Text;
//MyMsg.Priority = (MailPriority)ddlPriority.SelectedIndex;
//MyMsg.BodyFormat= (MailFormat)str;
MyMsg.Body = Tbmsgtext.Text;
string strPath;
strPath=Server.MapPath(".")+"\\warning.gif";
MyMsg.Attachments.Add(new MailAttachment(strPath));
try
{
SmtpMail.Send(MyMsg);
Label5.Text="发送成功!";
}
catch
{
Label5.Text="发送失败!";
}
string str="文本格式";
MailMessage MyMsg = new MailMessage();
MyMsg.From = Tbfrom.Text;
MyMsg.To = Tbto.Text;
MyMsg.Cc = "";
MyMsg.Bcc = "";
MyMsg.Subject = Tbsubject.Text;
//MyMsg.Priority = (MailPriority)ddlPriority.SelectedIndex;
//MyMsg.BodyFormat= (MailFormat)str;
MyMsg.Body = Tbmsgtext.Text;
string strPath;
strPath=Server.MapPath(".")+"\\warning.gif";
MyMsg.Attachments.Add(new MailAttachment(strPath));
try
{
SmtpMail.Send(MyMsg);
Label5.Text="发送成功!";
}
catch
{
Label5.Text="发送失败!";
}
解决方案 »
- return db.VideoCategories.Where(a => a.TypeId ==id).ToList();
- .net 表格不能完全释放内存
- 请教各位高手!
- 留言板
- C# winform中DataGridView中有一个ContextMenuScript 怎么样实现右键对本行数据的修改 删除
- HTTP/1.1 500 Internal Server Error 如何解决!
- 如何返回上页
- 水晶报表问题(小虾,不富裕,20分成交)
- Excel模板填充问题
- 大家帮忙看一下!
- 怎样在MDI子窗口中给父窗口中的菜单赋值?
- 高手留步!请问哪儿有.net编程手册的电子书?(详细介绍控件属性、事件、方法等)
其一:
MailMessage mm = new MailMessage();
mm.From = "##@hotmail.com";
mm.To = ""#####@hotmail.com";
mm.Subject = "呵呵!";
mm.Body = "**";
mm.Attachments.
SmtpMail.SmtpServer ="10.88.0.7";
SmtpMail.Send(mm);
this.Response.Write("<script>alert(\"发送成功!\")</script>");
其中SmtpMail.SmtpServer ="10.88.0.7";是指LAN内邮件服务器地址。
其二:
public bool sendMail()
{
MessageClass email = new MessageClass();
email.Logging = true;
email.Silent = true;
email.MailServerUserName = "[email protected]";
email.MailServerPassWord = "124";
email.From = "[email protected]";
email.Subject = "jmail";
email.AddAttachment("c:\\test.xml",true,"");
email.Body = "test jmail send mail";
email.AddRecipient("[email protected]", "abc", null);
return email.Send("mail.163.com", false)
}