SMTP代理 [英] Proxy with smtp

查看:78
本文介绍了SMTP代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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客户端?如果没有,那么我如何从代理后面发送电子邮件服务器.. ??

I am using the given code to send emails ...i am behind a proxy server..is there any way to give the proxy settings to the smtp client??If not then how do i send emails from behind a proxy server..??

这些是我用于连接互联网的设置...我也需要在我的电子邮件客户端中设置此设置.

These are the settings i need to use to connect to the internet...i need to set this settings in my email client also.

推荐答案

我曾经有一个用于这种东西的软件包,称为鱿鱼代理.对我来说非常有用.

there is a package I once used for things like this called squid proxy. It was very useful to me.

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

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

我希望这会有所帮助.

这篇关于SMTP代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆