Backup/Web/App_Code/Pop3ForJmail.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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 jmail;

/// <summary>
/// Pop3ForJmail 的摘要说明
/// </summary>
public class Pop3ForJmail
{
    public Pop3ForJmail()
    {
        
    }
    /// <summary>
    /// 收取新邮件、不删除老邮件、收取邮件后写入数据库
    /// </summary>
    public static void GetNewMailIntoDataBase(string UserName,string PassWord,string PopServer,int Port,DateTime MaxDate)
    {
        POP3 NewMail = new POP3();
        NewMail.Connect(UserName, PassWord, PopServer, Port);        
        for (int i = 1; i <= NewMail.Count; i++)
        {
            //判断是否跟当前最大的时间作比较,大于当前时间就处理
            DateTime CurrentEmailDate = DateTime.Now;
            try
            {
                CurrentEmailDate = DateTime.Parse(NewMail.Messages[i].Date.ToString());
            }
            catch
            { }

            try
            {
                if (CurrentEmailDate.CompareTo(MaxDate) > 0)
                {
                    string EmailFuJian = "";
                    for (int j = 0; j < NewMail.Messages[i].Attachments.Count; j++)
                    {
                        try
                        {
                            string FileName = DateTime.Now.Ticks.ToString() + NewMail.Messages[i].Attachments[j].Name;
                            NewMail.Messages[i].Attachments[j].SaveToFile(System.Web.HttpContext.Current.Request.MapPath("../UploadFile") + "\\MailAttachments\\" + FileName);
                            if (EmailFuJian.Trim().Length > 0)
                            {
                                EmailFuJian = EmailFuJian + "|MailAttachments/" + FileName;
                            }
                            else
                            {
                                EmailFuJian = "MailAttachments/" + FileName;
                            }
                        }
                        catch (Exception e)
                        {
后面还有 89 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。