发邮件代码那里错了??
using System.Web.Mail;
private void button6_Click(object sender, System.EventArgs e)
{
try
{
MailMessage mm=new MailMessage();
mm.BodyFormat=MailFormat.Text;
mm.To=this.textBox1.Text.Trim();
mm.From=this.textBox2.Text.Trim();
mm.Subject=this.textBox4.Text.Trim();
mm.Body=this.textBox3.Text.Trim();
SmtpMail.SmtpServer="smtp.163.com";
SmtpMail.Send(mm);
MessageBox.Show("ok");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString()); }
}
using System.Web.Mail;
private void button6_Click(object sender, System.EventArgs e)
{
try
{
MailMessage mm=new MailMessage();
mm.BodyFormat=MailFormat.Text;
mm.To=this.textBox1.Text.Trim();
mm.From=this.textBox2.Text.Trim();
mm.Subject=this.textBox4.Text.Trim();
mm.Body=this.textBox3.Text.Trim();
SmtpMail.SmtpServer="smtp.163.com";
SmtpMail.Send(mm);
MessageBox.Show("ok");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString()); }
}
解决方案 »
- 在框架中传递属性
- 急求 C#问题
- sql问题
- 活动目录编程:如何把一个用户添加到一个指定的用户组呢?
- 关于socket的监听多线程问题.....
- 调用一个delphil DLL的接口,接口中有一个 _Recordset 的类型,如何使用阿,找不到类型或命名空间名称“Recordset”(是否缺少 using 指令或
- Xenocode Postbuild 2009 混淆器的问题
- 大家好,一起来看看这样一张表,怎么设计才是最好的方法
- two stars,散分ing!
- C#大约什么时候出
- 80分求解des加密与解密问题,小问题,但总得不到正确结果
- System.Net.Sockets.Socket问题,由于系统缓冲区空间不足或列队已满~
mail.To = "[email protected]";
mail.From = "[email protected]";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "AlleNny"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "Password"); //set your password here
SmtpMail.SmtpServer = "smtp.163.com"; //your real server goes here
SmtpMail.Send( mail );
1、使用socket进行smtp编程。发送User和PWD等命令
2、使用CDO的MessageClass
“EHLO ”+ mailserver + enter;
"AUTH LOGIN “+Base64Encode(username) + enter;
+Base64Encode(password) + enter;
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "用户名"); mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "密码");
add的第一个参数是什么意思?(如("http://schemas.microsoft.com/cdo/configuration/sendusername"), 必须要这样吗?我知其然不知其所以然呢??
回答了我结分了