如何拦截 POP3 服务器上的邮件消息

发布于 2024-10-28 20:00:11 字数 61 浏览 2 评论 0原文

我需要一个应用程序来拦截所有传入的邮件消息并根据某些规范对其进行修改。 我在这方面绝对是菜鸟,请详细说明:)

I need an application that will intercept all incoming mail messages and modify them according to some specs.
I am an absolute rookie at this, please detail :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寄居者 2024-11-04 20:00:11

试试这个示例代码

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

Try this sample code

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
夏尔 2024-11-04 20:00:11

所有传入消息都将通过 SMTP 发送。

因此,您需要执行以下两件事之一:

  1. 如果您当前的服务器支持它,请挂钩它的 SMTP 事件,并在消息传递给本地目标用户之前修改消息。

  2. 您将需要一个位于真实 SMTP 服务器前面的 SMTP 代理服务。

在 SMTP 代理内部,修改消息,并将其传递到真实的 SMTP 服务器。

All incoming messages will be coming on over SMTP.

So, you need to do 1 of 2 things:

  1. If your current server supports it, hook into it's SMTP events, and modify the message before it is passed on to the local intended user.

    or

  2. You will need a SMTP proxy service, that sits in front of your real SMTP server.

Inside of the SMTP proxy, modify the message, and pass it on to your real SMTP server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文