コード例 #1
0
        public SmtpSessionInfo()
        {
            CreatedTimestamp = DateTime.UtcNow;

            Identification = new SmtpIdentification();
            Recipients     = new List <MailAddressWithParameters>();
        }
コード例 #2
0
        protected override SmtpResponse ProcessCommandEhlo(string name, string arguments)
        {
            if (String.IsNullOrWhiteSpace(arguments))
            {
                return(new SmtpResponse(501, "EHLO Missing domain address. (#5.5.0)"));
            }

            var identification = new SmtpIdentification(SmtpIdentificationMode.EHLO, arguments);
            var response       = _responderFactory.IdentificationResponder.VerifyIdentification(SessionInfo, identification);

            if (response.Success)
            {
                SessionInfo.Identification = identification;
            }

            return(response);
        }
        public virtual SmtpResponse VerifyIdentification(ISmtpSessionInfo sessionInfo, SmtpIdentification smtpIdentification)
        {
            if (smtpIdentification == null)
            {
                throw new ArgumentNullException("smtpIdentification");
            }

            switch (smtpIdentification.Mode)
            {
            case SmtpIdentificationMode.HELO:
                return(VerifyHelo());

            case SmtpIdentificationMode.EHLO:
                return(VerifyEhlo());
            }

            return(new SmtpResponse(500, "Invalid Identification (" + smtpIdentification.Mode + ")"));
        }