Beispiel #1
0
        /// <summary>
        /// Raises <b>GetMessageStream</b> event.
        /// </summary>
        /// <returns>Returns message store stream.</returns>
        private Stream OnGetMessageStream()
        {
            if(this.GetMessageStream != null){
                SMTP_e_Message eArgs = new SMTP_e_Message(this);
                this.GetMessageStream(this,eArgs);

                return eArgs.Stream;
            }

            return null;
        }
Beispiel #2
0
 /// <summary>
 /// Is raised when SMTP server session needs to get stream where to store incoming message.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event data.</param>
 private void m_pSmtpServer_Session_GetMessageStream(object sender,SMTP_e_Message e)
 {
     if(!Directory.Exists(m_MailStorePath + "IncomingSMTP")){
         Directory.CreateDirectory(m_MailStorePath + "IncomingSMTP");
     }
     
     e.Stream = new FileStream(API_Utlis.PathFix(m_MailStorePath + "IncomingSMTP\\" + Guid.NewGuid().ToString().Replace("-","") + ".eml"),FileMode.Create,FileAccess.ReadWrite,FileShare.ReadWrite,32000,FileOptions.DeleteOnClose); 
     e.Session.Tags["MessageStream"] = e.Stream;
 }