问题描述
也可以给我参考的代码
解决方案
解决方案二:
解决方案三:
发送邮件:protectedvoidSendSuccess(){System.Net.Mail.MailMessagemessage=newSystem.Net.Mail.MailMessage();message.From=newMailAddress("test@gmail.com","someone");//必须是提供smtp服务的邮件服务器message.To.Add(newMailAddress("test@yahoo.com.cn"));message.Subject="测试邮件";message.CC.Add(newMailAddress("test@126.com"));message.Bcc.Add(newMailAddress("test@126.com"));message.IsBodyHtml=true;message.BodyEncoding=System.Text.Encoding.UTF8;message.Body="邮件发送测试";message.Priority=System.Net.Mail.MailPriority.High;SmtpClientclient=newSmtpClient("smtp.gmail.com",587);//587;//Gmail使用的端口client.Credentials=newSystem.Net.NetworkCredential("test@gmail.com","password");//这里是申请的邮箱和密码client.EnableSsl=true;//必须经过ssl加密try{client.Send(message);Response.Write("邮件已经成功发送到"+message.To.ToString()+"<br>");}catch(Exceptionee){Response.Write(ee.Message+"<br>"/*+ee.InnerException.Message*/);}}接收邮件usingLumiSoft.Net.POP3.Client;usingLumiSoft.Net.Mail;……publicIList<Mail_Message>ReceiveMail(){IList<Mail_Message>mailList=newList<Mail_Message>();using(POP3_Clientclient=newPOP3_Client()){client.Connect("pop.gmail.com",995,true);client.Authenticate("zw.seaman","zw_seaman",false);POP3_ClientMessageCollectioncoll=client.Messages;for(inti=0;i<coll.Count;i++){POP3_ClientMessagemessage=coll[i];Mail_Messagemm=Mail_Message.ParseFromByte(coll[i].MessageToByte());mailList.Add(mm);}}returnmailList;}protectedvoidPage_Load(objectsender,EventArgse){IList<Mail_Message>mailList=newZMail.Mail().ReceiveMail();foreach(Mail_MessagemailinmailList){StringBuildersb=newStringBuilder();sb.Append(mail.From.ToString()).Append("发送给");sb.Append(mail.To.ToString()).Append("<br/>");sb.Append(mail.Subject).Append("<br/>");sb.Append(mail.BodyHtmlText).Append("<hr/>");Response.Write(sb.ToString());}}
解决方案四:
楼上的貌似可以,楼主可以调试一下。
解决方案五:
该回复于2011-12-15 16:53:46被版主删除