Example #1
0
        public POP3message(int ID,BitMsg MSG,BitAddr[] LocalAddr)
        {
            string rec = MSG.toAddress.Replace(BR_SUB, BR);
            if (rec == BR)
            {
                rec = string.Format("'Broadcast subscribers' <{0}@{1}>", BR, Program.BS.Extension);
            }
            else
            {
                foreach (BitAddr a in LocalAddr)
                {
                    if (a.address == rec)
                    {
                        rec = string.Format("'{0}' <{1}@{2}>", a.label.Replace('"', '_'), rec, Program.BS.Extension);
                    }
                }
            }
            MSG.message.Replace("\r\n", "\n");
            if (!isMail(MSG.message))
            {
                //prepend Mail Headers
                Body += string.Format(@"Return-Path: {0}@{4}
            To: {1}@{4}
            From: {0}@{4}
            Subject: {2}
            Date: {3}
            Received: {3}

            ", MSG.fromAddress, rec.Replace(BR_SUB, BR), MSG.subject, UnixTime.ConvertFrom(MSG.receivedTime).ToString("R"),Program.BS.Extension);
                Body += MSG.message;
            }
            else
            {
                //Valid Mail, use sent headers.
                if (isMailList(MSG.message))
                {
                    MSG.message = MSG.message.Substring(MSG.message.IndexOf('\n') + 1);
                    MSG.message = MSG.message.Substring(MSG.message.IndexOf('\n') + 1);
                    Body += MSG.message;
                }
                else
                {
                    Body += MSG.message;
                }
            }
            UID = MSG.msgid;
            Deleted = false;
        }
Example #2
0
        private static void adminMsg(string subject, string body)
        {
            BitAddr a = new BitAddr();

            a.address = "admin";
            a.enabled = true;
            a.label   = "local admin";
            a.stream  = 1;

            BitMsg BM = new BitMsg();

            BM.encodingType = 3;
            BM.fromAddress  = "cmd";
            BM.toAddress    = "admin";
            BM.message      = body;
            BM.subject      = subject;
            BM.receivedTime = UnixTime.ConvertTo(DateTime.Now);
            BM.msgid        = MsgCount.ToString();
            MsgCount++;
            AuxMessages.Add(new POP3message(0, BM, new BitAddr[] { a }));
        }
Example #3
0
        private static void adminMsg(string subject, string body)
        {
            BitAddr a = new BitAddr();
            a.address = "admin";
            a.enabled = true;
            a.label = "local admin";
            a.stream = 1;

            BitMsg BM = new BitMsg();
            BM.encodingType = 3;
            BM.fromAddress = "cmd";
            BM.toAddress = "admin";
            BM.message = body;
            BM.subject = subject;
            BM.receivedTime = UnixTime.ConvertTo(DateTime.Now);
            BM.msgid = MsgCount.ToString();
            MsgCount++;
            AuxMessages.Add(new POP3message(0, BM, new BitAddr[] { a }));
        }