Esempio n. 1
0
        /// <summary>
        /// Establishes a connection to the mail server.
        /// </summary>
        /// <returns>true if the connection is successful; otherwise, false</returns>
        public bool Connect()
        {
            IPAddress mail_server_address;

            if (IPAddress.TryParse(mail_server_address_, out mail_server_address))
            {
                mail_server_socket_.Connect(mail_server_address, 25);
                if (mail_server_socket_.Connected)
                {
                    SmtpReply reply = GetReply();
                    return(reply.Code == 220);
                }
            }
            return(false);
        }
Esempio n. 2
0
 public void MessageWithCodeLessThanMin() {
     SmtpReply smtp = new SmtpReply(10, string.Empty);
 }
Esempio n. 3
0
 public void MessageWithCodeGreaterThanMax() {
     SmtpReply smtp = new SmtpReply(1000, string.Empty);
 }
Esempio n. 4
0
 public void MessageWithBoundsOverload() {
     byte[] message = Encoding.ASCII.GetBytes("205 Smtp Reply BaseMessage Without Code");
     SmtpReply smtp = new SmtpReply(message, 0, message.Length + 10);
 }
Esempio n. 5
0
 public void MessageWithNegativeOffset() {
     byte[] message = Encoding.ASCII.GetBytes("205 Smtp Reply BaseMessage Without Code");
     SmtpReply smtp = new SmtpReply(message, -1, message.Length);
 }
Esempio n. 6
0
 public void InvalidReplyException() {
     byte[] message = Encoding.ASCII.GetBytes("Smtp Reply BaseMessage Without Code");
     SmtpReply smtp = new SmtpReply(message, 0, message.Length);
 }
Esempio n. 7
0
 public void SmtpReplyParseByteArray() {
     byte[] message = Encoding.ASCII.GetBytes("205 Smtp Reply BaseMessage");
     SmtpReply smtp = new SmtpReply(message, 0, message.Length);
     Assert.AreEqual(205, smtp.Code);
     Assert.AreEqual(smtp.Message, "Smtp Reply BaseMessage");
 }