Exemplo n.º 1
0
        public void TriggerNewMessage(SMTPTransaction transaction, MailPath sender, MailPath[] recipients, string body)
        {
            var mail = new Mail(sender.ToMailAdress(), recipients.Select(r => r.ToMailAdress()).Where(r => r != null),
                                body);

            if (OnNewMessage != null)
            {
                OnNewMessage(transaction, mail);
            }
        }
Exemplo n.º 2
0
        public SMTPTransaction StartTransaction(IPAddress address, IReceiveSettings settings, out SMTPResponse response)
        {
            var transaction = new SMTPTransaction(this, settings);

            if (OnConnect != null)
            {
                var args = new ConnectEventArgs(address);
                OnConnect(transaction, args);

                if (args.Cancel)
                {
                    response = new SMTPResponse(args.ResponseCode ?? SMTPStatusCode.TransactionFailed);
                    transaction.Close();
                    return(transaction);
                }
            }

            response = new SMTPResponse(SMTPStatusCode.Ready, settings.Banner);

            return(transaction);
        }