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

                return eArgs.Stream;
            }

            return null;
        }
 private void OnSessionGetMessageStream(object sender, SMTP_e_Message e)
 {
     try
     {
         var messageFileName = Path.Combine(_mailFolder, DateTime.UtcNow.ToString("yyyy'-'MM'-'dd HH'-'mm'-'ss'Z'") + ".eml");
         e.Stream = new FileStream(messageFileName, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite, 8096, _storeIncomingMail ? FileOptions.None : FileOptions.DeleteOnClose);
     }
     catch (Exception error)
     {
         _log.Error("error while allocating temporary stream for the message", error);
     }
 }