收发邮件
来源:互联网 发布:原生js实现加载更多 编辑:程序博客网 时间:2024/05/16 15:14
发邮件:
//邮件发送
public void GetMail(string toaddr,string fromaddr,string subject,string body,string uid,string pwd,string server)
{
MailMessage mail = new MailMessage();
mail.To = toaddr;//发送邮件的地址,多个可用“,”隔开。;
mail.From = fromaddr;
mail.Subject = subject;
mail.Body = body;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//是否需要验证,一般是要的
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", uid);
//自己邮箱的用户名
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", pwd);
//自己邮箱的密码
SmtpMail.SmtpServer = server;
SmtpMail.Send(mail);
}
使用是JMAIL收邮件:
jmail.POP3Class jpop = new jmail.POP3Class();
private void getMail()
{
this.LBtitle.Text = "";
this.LBContent.Text = "";
this.LBDate.Text = "";
this.LBFrom.Text = "";
this.Lb_attach.Text = "";
jmail.Message Msg = new jmail.Message();
jmail.Attachments atts;
jmail.Attachment att;
//Mime m = new Mime();
//username为用户名,该方法通过用户名获取该用户的pop设置,即用户的POP用户名,密码,POP服务器地址以及端口号这四个参数,这四个参数是连接POP服务器的必用参数.
//连接POP服务器
jpop.Connect(this.TB_UserName.Text, this.TB_Pwd.Text, this.TB_pop3server.Text, 110);
Msg = jpop.Messages[Convert.ToInt16(this.TB_mailNumber.Text)];
Msg.ContentType = "text/html";
Msg.Charset = "GB2312";
this.LBnewNum.Text = jpop.Count.ToString();
this.LBtitle.Text += "title:" + Msg.Subject + "<br/>";
this.LBDate.Text += "date:" + Msg.Date.ToString()+"<br/>";
this.LBFrom.Text += "from::" + Msg.FromName + "<" + Msg.From + ">";
this.LBContent.Text += Msg.Body;
if (Msg.Attachments.Count > 0)
{
this.Lb_attach.Text = Msg.Attachments[0].Name + ".pdf";
Msg.Attachments[0].SaveToFile(System.Web.HttpContext.Current.Server.MapPath("//mailattach//") + Msg.Attachments[0].Name + ".pdf");
}
jpop.Disconnect();
Msg.Close();
}
- 收发邮件
- 邮件收发
- 收发邮件
- 使用Ruby收发邮件
- java邮件收发
- .NET邮件的收发
- 使用rails收发邮件
- Indy10 邮件收发研究
- 使用JavaMail收发邮件
- 使用Ruby收发邮件
- linux收发邮件命令
- spring收发邮件
- linux ThunderBird收发邮件
- 用telnet收发邮件
- javamail 收发 文本邮件
- 收发邮件功能
- .NET邮件的收发
- java收发邮件过程.
- ASP.NET,抬起头来,让朕瞧瞧
- asp.net 操作EXCEL
- JDBC连接MySQL公共类
- CSS属性代码大全
- netbeans 6.5 下的地图编辑器插件
- 收发邮件
- Windows Socket 网络编程(一) —— TCP/IP体系结构、特点及相关术语
- 青年人必须尝试的30件事
- 解读session
- C#读取记事本内容进行分类问题
- S2-即将到来的考试
- WTL工程中出现运行“Did you forget to pass the LIBID to CComModule::Init”的解决方法
- JS控制浏览器导航的几种方法
- Cookie欺骗原理