public Email GetEmail(int index) // 获取某封邮件(RETR指令) { if (Connected) { String RawEmail = SendCmd("RETR " + index, true); if (RawEmail.Contains("deleted") || RawEmail.Contains("not exists")) // 若邮件已经被删除,则不处理 { return(null); } return(MIME.GetEmail(RawEmail, index)); } return(null); }
public Heading GetHeading(int index) // 获取摘要(TOP指令) { if (Connected) { String RawEmail = SendCmd("TOP " + index + " 0", true); if (RawEmail.Contains("deleted") || RawEmail.Contains("not exists") || RawEmail == "") // 若邮件已经被删除,则不处理 { return(null); } return(MIME.GetHeading(RawEmail, index)); } return(null); }
public void SendEmail(Email email) // 发送邮件 { if (this.Connected) { /*请求发送邮件*/ this.SendCmd(String.Format("MAIL FROM:<{0}>", email.Head.From)); this.SendCmd(String.Format("RCPT TO:<{0}>", email.Head.To)); this.SendCmd("DATA"); /*发送邮件*/ string str = MIME.GetMIMEStr(email); this.SendCmd(str, false, 0); /*发送结束*/ this.SendCmd("."); } }