2

有什么方法可以使用 .NET获取SMTP 服务器问候消息SmtpClient

问候消息是 SMTP 服务器响应的第一行:

S: 220 smtp.example.com ESMTP Postfix    <----- I need this line
C: HELO relay.example.org
S: 250 Hello relay.example.org, I am glad to meet you
C: MAIL FROM:<bob@example.org>
S: 250 Ok
C: RCPT TO:<alice@example.com>
S: 250 Ok
C: RCPT TO:<theboss@example.com>
S: 250 Ok
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: From: "Bob Example" <bob@example.org>
C: To: "Alice Example" <alice@example.com>
C: Cc: theboss@example.com
C: Date: Tue, 15 January 2008 16:02:43 -0500
C: Subject: Test message
C:
C: Hello Alice.
C: This is a test message with 5 header fields and 4 lines in the message body.
C: Your friend,
C: Bob
C: .
S: 250 Ok: queued as 12345
C: QUIT
S: 221 Bye
{The server closes the connection}

提前致谢!

沃特

4

1 回答 1

2

SmtpClient 旨在抽象出诸如此类的 SMTP 细节。

您最好打开与 SMTP 服务器的套接字连接并从中读取响应。

于 2012-11-15T15:34:05.443 回答