当前位置:编程学习 > C#/ASP.NET >>

在网站上做邮箱功能

请问各位高手,在网站上做一个像163那样的邮箱登陆功能!如何实现?原理是什么? --------------------编程问答-------------------- 其实登录 很普通
他做的好是因为他的JQ和JS使用的好 所以看着效果比较高级

你慢慢分析他 其实他最终的目的还是登录

只不过带 安全模式(SSL) 据说这个模式是收费的一个证书。。不清楚

还有就是什么两周保存 其实就是缓存机制

版本什么的 就是选择样式 1和0的区别 判断下而已 --------------------编程问答-------------------- 这个要调接口的 你问下 --------------------编程问答-------------------- 我们系统里面有这个需求,CS代码如下:用到一些WCF,读取配置文件及其他的,自己对应着修改一下就行了


using System.Linq;

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using LumiSoft.Net.POP3.Client;
using LumiSoft.Net.Mime;
using System.IO;
public partial class Admin_EmailFax_EmailReceive : System.Web.UI.Page
{
    //private string _POPServer;
    //private string _user;
    //private string _pwd;
    //private NetworkStream _ns;
    //private StreamReader _sr;
    //private int _count;
    private string _Euser = "", _Epwd = "", _Epop3 = "", _Esmtp = "", _Edel = "", _ENm = "";
    private bool bln30, bln3001, bln3002, bln3003, bln3004,bln3005,bln3006;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (1 == 1)
        {
            HWOAWCF.P_MasterClient wcf = new HWOAWCF.P_MasterClient();
            wcf.Open();
            bln30 = wcf.P_Master_Authentication(ClsHWOA.ReturnLoginUser(), "30");//浏览列表
            bln3001 = wcf.P_Master_Authentication(ClsHWOA.ReturnLoginUser(), "3001");//增加
            bln3002 = wcf.P_Master_Authentication(ClsHWOA.ReturnLoginUser(), "3002");//修改
            bln3003 = wcf.P_Master_Authentication(ClsHWOA.ReturnLoginUser(), "3003");//删除
            bln3004 = wcf.P_Master_Authentication(ClsHWOA.ReturnLoginUser(), "3004");//查看
            bln3005 = wcf.P_Master_Authentication(ClsHWOA.ReturnLoginUser(), "3005");//查看
            bln3006 = wcf.P_Master_Authentication(ClsHWOA.ReturnLoginUser(), "3006");//查看
            wcf.Close();

            ClsHWOA.JudgeAction(bln3002);//邮件接收权限
            
        }
        if (1 == 1)
        {
            HWOAWCF.S_Config_BClient wcfX = new HWOAWCF.S_Config_BClient();
            wcfX.Open();
            string[] arrZX = wcfX.S_Config_B_QueryByCID_USERNAME(7, "0000").Content.Split(',');
            if (arrZX.Length == 6)
            {
                _Euser = arrZX[0];
                _Epwd = arrZX[1];
                _Epop3 = arrZX[2];
                _Esmtp = arrZX[3];
                _Edel = arrZX[4];
                _ENm = arrZX[5];
            }
            wcfX.Close();

        }
        if (1 == 1)
        {
            string error = "";
            //_POPServer = "pop.163.com";
            //_user = "hwoa_test@163.com";
            //_pwd = "123456";
            //Response.Write(_Epop3);
            //Response.End();
            string pop3Server = _Epop3;// "pop.163.com";    //邮箱服务器 如:"pop.sina.com.cn";或 "pop.tom.com" 好像sina的比较快
            int pop3Port = 110;          //端口号码   用"110"好使。最好看一下你的邮箱服务器用的是什么端口号
            bool pop3UseSsl = false;
            string username = _Euser;// "xxxx@163.com";        //你的邮箱用户名
            string password = _Epwd;// "xxxx";      //你的邮箱密码
            POP3_Client pc = new POP3_Client();
            pc.Connect(pop3Server, pop3Port, pop3UseSsl);//与Pop3服务器建立连接
            pc.Authenticate(username, password, false);//验证身份
            POP3_ClientMessageCollection infos = pc.Messages;//获取邮件信息列表
            List<string> gotEmailIds = new List<string>();

            List<Mime> result = new List<Mime>();


            HWOAWCF.Email_RClient wcf = new HWOAWCF.Email_RClient();
            HWOAWCF.Email_File_RClient wcfF = new HWOAWCF.Email_File_RClient();
            wcfF.Open();
            wcf.Open();
            foreach (POP3_ClientMessage info in infos)
            {
                //每封Email会有一个在Pop3服务器范围内唯一的Id,检查这个Id是否存在就可以知道以前有没有接收过这封邮件
                if (gotEmailIds.Contains(info.UID))
                    continue;
                byte[] bytes = info.MessageToByte();//获取这封邮件的内容

                gotEmailIds.Add(info.UID);//记录这封邮件的Id
                //Mime m = Mime.Parse(mail.MessageToByte());
                Mime mm = Mime.Parse(info.MessageToByte());//获取这封邮件的内容
                result.Add(mm);
                try
                {
                    if (!wcf.Email_R_Contains(info.UID))//判断数据库中是否有记录
                    {
                        //string body = mm.BodyText;
                        //if (body == null) body = mm.BodyHtml;
                        string body = mm.BodyText;
                        if (body == null) body = mm.BodyHtml;
                        int eid = wcf.Email_R_Add(new HWOAWCF.Email_R { EmailUID = info.UID, Content = body, ETitle = mm.MainEntity.Subject, SendUser = mm.MainEntity.From.ToAddressListString(), TM = mm.MainEntity.Date });
                        if (eid > 0)
                        {
                            //获取附件
                            foreach (MimeEntity entry in mm.Attachments)
                            {
                                string fileName = entry.ContentDisposition_FileName; //获取文件名称
                                string path = Server.MapPath("../../UploadEmailFile") + "\\";
                                if (fileName != null)
                                {
                                    //Response.Write(fileName + "<br>");
                                    string newFileName = fileName;
                                    //string saveFilePath = path + "\\" + fileName;
                                    if (File.Exists(path + newFileName))
                                    {
                                        newFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + fileName;
                                    }

                                    byte[] data = entry.Data;
                                    FileStream pFileStream = null;
                                    pFileStream = new FileStream(path + newFileName, FileMode.Create);
                                    pFileStream.Write(data, 0, data.Length);
                                    pFileStream.Close();
                                    wcfF.Email_File_R_Add(new HWOAWCF.Email_File_R { EID = eid, FileName = newFileName, FTitle = fileName });
                                }
                            }
                        } 
                        if (_Edel == "1")
                            pc.Messages[info.UID].MarkForDeletion();//删除邮件

                    }
                    else
                    {
                        if (_Edel == "1") 
                            pc.Messages[info.UID].MarkForDeletion();//删除邮件
                    }
                }
                catch
                {
                    error += "<br>  ●" + mm.MainEntity.Subject;
                }


            }
            wcf.Close();
            wcfF.Close();

            if (error.Length > 0)
                error = "<br><br>  ●请注意:以下信件接收未成功,请登录邮箱服务器查看:" + error;
            ClsMsg.ShowSuccess("接收完毕!" + error, "EmailReceiveDefault.aspx", 5, false, false);

        }
    }
}
--------------------编程问答-------------------- 是多选邮箱?
还是类似百度登陆效果? --------------------编程问答-------------------- 是做一个自己企业的邮箱! --------------------编程问答-------------------- 免费的http://download.csdn.net/source/2741250
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,