Esempio n. 1
0
        /// <summary>
        /// Raises <b>StoreMessage</b> event.
        /// </summary>
        /// <param name="folder">Folder name with optional path.</param>
        /// <param name="flags">Message flags.</param>
        /// <param name="date">Message IMAP internal date.</param>
        /// <param name="size">Message size in bytes.</param>
        /// <param name="response">Default IMAP server response.</param>
        /// <returns>Returns event args.</returns>
        private IMAP_e_Append OnAppend(string folder,string[] flags,DateTime date,int size,IMAP_r_ServerStatus response)
        {
            IMAP_e_Append eArgs = new IMAP_e_Append(folder,flags,date,size,response);
            if(this.Append != null){
                this.Append(this,eArgs);
            }

            return eArgs;
        }
Esempio n. 2
0
        private void m_pImapServer_Session_Append(object sender,IMAP_e_Append e)
        {
            try{
                IMAP_Session ses = (IMAP_Session)sender;

                e.Stream = new MemoryStreamEx(32000);
                e.Completed += new EventHandler(delegate(object s1,EventArgs e1){
                    e.Stream.Position = 0;

                    m_pApi.StoreMessage(
                        ses.AuthenticatedUserIdentity.Name,
                        ses.AuthenticatedUserIdentity.Name,
                        e.Folder,
                        e.Stream,
                        e.InternalDate == DateTime.MinValue ? DateTime.Now : e.InternalDate,
                        e.Flags
                    );
                });               
            }
            catch(Exception x){
                e.Response = new IMAP_r_ServerStatus(e.Response.CommandTag,"NO","Error: " + x.Message);
            }
        }