我需要一个应用程序来拦截所有传入的邮件消息并根据某些规范对其进行修改。我是这方面的绝对菜鸟,请详细说明:)
问问题
2024 次
2 回答
0
所有传入的消息都将通过 SMTP 发送。
所以,你需要做两件事中的一件:
如果您当前的服务器支持它,请连接到它的 SMTP 事件,并在将消息传递给本地预期用户之前对其进行修改。
或者
您将需要一个 SMTP 代理服务,它位于您真正的 SMTP 服务器的前面。
在 SMTP 代理内部,修改消息,并将其传递到您的真实 SMTP 服务器。
于 2011-04-01T12:54:06.440 回答
0
试试这个示例代码
Dim _tcpClient As New TcpClient
Dim _networkStream As NetworkStream
Dim _Msg As String
With _tcpClient
.Connect(Me.txtServerIp.Text, Integer.Parse(Me.txtPortNum.Text))
_networkStream = .GetStream
Dim sw As New StreamWriter(_networkStream)
Dim sr As New StreamReader(_networkStream)
If Not CheckError(sr.ReadLine()) Then
sw.WriteLine(String.Format("USER {0}", Me.txtUsername.Text))
sw.Flush()
End If
If Not CheckError(sr.ReadLine()) Then
sw.WriteLine(String.Format("PASS {0}", Me.txtPassword.Text))
sw.Flush()
End If
If Not CheckError(sr.ReadLine()) Then
sw.WriteLine("STAT ")
sw.Flush()
End If
_Msg = sr.ReadLine
Dim MsgCount As String = _Msg.Split(New String() {" "}, _
StringSplitOptions.RemoveEmptyEntries)(1)
If Integer.Parse(Me.lblMsgCount.Text) < Integer.Parse(MsgCount) Then
Me.lblMsgCount.Text = MsgCount
End If
sw.WriteLine("Quit ")
sw.Flush()
sw.Close()
sr.Close()
_networkStream.Close()
_tcpClient.Close()
End With
于 2011-03-31T15:00:04.753 回答