Ejemplo n.º 1
0
        /// <summary>
        /// This method is called when asynchronous <b>Authenticate</b> method completes.
        /// </summary>
        /// <param name="ar">An IAsyncResult that stores state information and any user defined data for this asynchronous operation.</param>
        private void AuthenticateCallback(IAsyncResult ar)
        {
            try{
                m_pSmtpClient.EndAuthenticate(ar);

                long messageSize = -1;
                try{
                    messageSize = m_pRelayItem.MessageStream.Length - m_pRelayItem.MessageStream.Position;
                }
                catch {
                    // Stream doesn't support seeking.
                }

                m_pSmtpClient.BeginMailFrom(
                    this.From,
                    messageSize,
                    IsDsnSupported() ? m_pRelayItem.DSN_Ret : SMTP_DSN_Ret.NotSpecified,
                    IsDsnSupported() ? m_pRelayItem.EnvelopeID : null,
                    new AsyncCallback(this.MailFromCallback),
                    null
                    );
            }
            catch (Exception x) {
                Dispose(x);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method is called when asynchronous <b>Authenticate</b> method completes.
        /// </summary>
        /// <param name="ar">An IAsyncResult that stores state information and any user defined data for this asynchronous operation.</param>
        private void AuthenticateCallback(IAsyncResult ar)
        {
            try{
                m_pSmtpClient.EndAuthenticate(ar);

                long messageSize = -1;
                try{
                    messageSize = m_pRelayItem.MessageStream.Length - m_pRelayItem.MessageStream.Position;
                }
                catch {
                    // Stream doesn't support seeking.
                }

                m_pSmtpClient.BeginMailFrom(this.From, messageSize, new AsyncCallback(this.MailFromCallback), null);
            }
            catch (Exception x) {
                Dispose(x);
            }
        }