【问题标题】:Proxy with smtp带 smtp 的代理
【发布时间】:2012-02-11 15:32:48
【问题描述】:
Private Function SendEMail(ByVal sendTo As String, ByVal subject As String) As Boolean
        Try
            ''# Dim cr As New System.Net.NetworkCredential("me073055", "me271288")
            ''# Dim pr As New System.Net.WebProxy("172.31.100.25", 3128)
            ''# pr.Credentials = cr


            Dim mail As New MailMessage()
            mail.[To].Add(sendTo)

            ''# MsgBox(mail.[To].ToString)

            mail.From = New MailAddress(TextBoxFromAddress.Text, "NyxSolutions")
            mail.Subject = subject & " Automation System"
            ''#  MsgBox(mail.Subject)
            Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString("", Nothing, "text/plain")
            Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=cid:companylogo><br/><a href='http://www.nyxsolutions.in'>Click Here to visit our website</a><br/><a href='mailto:info@nyxsolutions.in'> Click Here to send us an email</a>", Nothing, "text/html")

            Dim logo As New LinkedResource(TextBoxSelectPicture.Text)
            logo.ContentId = "companylogo"
            htmlView.LinkedResources.Add(logo)

            mail.AlternateViews.Add(plainView)
            mail.AlternateViews.Add(htmlView)
            Dim Body As String = ""
            mail.Body = Body
            mail.Attachments.Add(New Attachment(TextBoxAttachment1.Text))
            ''# mail.Attachments.Add(New Attachment(TextBoxAttachment2.Text))
            ''# mail.Attachments.Add(New Attachment(TextBoxAttachment3.Text))

            mail.IsBodyHtml = True
            Dim smtp As New SmtpClient()
            smtp.Host = "smtp.gmail.com"
            smtp.Port = 25
            smtp.UseDefaultCredentials = True
            smtp.Credentials = New System.Net.NetworkCredential(TextBoxFromAddress.Text, "vinson24")
            smtp.EnableSsl = True
            smtp.Send(mail)
            ''# MsgBox("Sent")
        Catch ex As SmtpException
            MsgBox(ex.Message)
        End Try
    End Function

我正在使用给定的代码发送电子邮件...我在代理服务器后面..有没有办法将代理设置提供给 smtp 客户端??如果没有,那么我如何从代理后面发送电子邮件服务器..??

这些是我需要用来连接到互联网的设置...我还需要在我的电子邮件客户端中设置这些设置。

【问题讨论】:

  • 一个 SMTP 代理?很简单:将邮件发送到代理。
  • 他们的客户端机器在代理后面吗? IE:使用outlook的办公室?如果是这样,请询问他们如何从代理后面进行身份验证...在您的应用中使用相同的设置。
  • @ChaseFlorell 我已经更新了问题...请检查一下。
  • @AndrewBarber 我已经更新了问题......请检查一下。

标签: .net vb.net


【解决方案1】:

我曾经使用过一个包,称为 squid 代理。这对我很有用。

http://squid-web-proxy-cache.1019090.n4.nabble.com/Can-squid-be-configured-as-SMTP-SMTPS-proxy-td2727188.html

http://www.squid-cache.org/

我希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2011-03-16
    • 2021-02-25
    • 1970-01-01
    • 2012-01-20
    • 1970-01-01
    • 2016-02-06
    • 1970-01-01
    • 2011-07-14
    • 2015-03-22
    相关资源
    最近更新 更多