如题
解决方案 »
- 用富文本编辑器存入数据库中的内容及图片怎么读出显示在文本框内?
- gridview动态绑定图片问题
- spring.net 遇到读取配置为空的问题
- 如何写类,并生成dll?
- OWC中SpreadSheet控件采用<object>嵌入到网页,怎么使它在其它层之下(如div下)?
- asp.net2005 自定义控件使用权限要求失败
- 搞asp.net这么久了,今天发现一个让我很郁闷的问题
- 请教高手一个问题!紧急!
- asp.net学习指南!!!望高手推荐(讨论贴,欢迎加入)
- 请教控件状态的问题
- 求一个简单新闻系统的源码,我正在学习ASP.NET,谢谢!
- 如何在asp.net下面实现文件拷贝?我想从服务器上将文件拷到客户端的电脑上,主要是存取数据库太麻烦。所以将有些文件想通过拷贝来实现。
-------------------
Dim objMailMessage As New MailMessage
objMailMessage.From = TextBox1.Text
objMailMessage.To = TextBox2.Text
objMailMessage.Subject = TextBox3.Text
objMailMessage.Body = "<html><body><img src=""clsusa_0624.jpg""></body></html>"
objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1)
objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "youmail")
objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mypassword")
SmtpMail.SmtpServer = "smtp.163.com"
SmtpMail.Send(objMailMessage)
using System.Web;
using System.Web.Mail; public class SystemMail : IMailProvider
{
public SystemMail(){}
private string _adminEmail;
public string AdminEmail
{
get{return _adminEmail;}
set{_adminEmail = value;}
} private string _smtpServer = "localhost";
public string SmtpServer
{
get{return _smtpServer;}
set{_smtpServer = value;}
} private string _password;
public string Password
{
get{return _password;}
set{_password = value;}
} private string _userName;
public string UserName
{
get{return _userName;}
set{_userName = value;}
} /// <summary>
/// 发送Email函数
/// </summary>
/// <param name="to">接收人</param>
/// <param name="from">发送人</param>
/// <param name="subject">标题</param>
/// <param name="message">发送信息</param>
/// <returns></returns>
public bool Send(string to, string from, string subject, string message)
{
try
{
MailMessage em = new MailMessage();
em.To = to;
em.From = from;
em.Subject = subject;
em.Body = message; //Found out how to send authenticated email via System.Web.Mail at http://SystemWebMail.com (fact 3.8)
if(this.UserName != null && this.Password != null)
{
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", this.UserName); //set your username here
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", this.Password); //set your password here
} SmtpMail.SmtpServer = this.SmtpServer;
SmtpMail.Send(em);
return true;
}
catch
{
return false;
}
}