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客户端?如果没有那么我如何从代理服务器后面发送电子邮件服务器..?
这些是我需要用来连接互联网的设置...我还需要在我的电子邮件客户端中设置此设置。
答案 0 :(得分:1)
有一个我用过的东西,比如这个叫squid代理的东西。这对我非常有用。
我希望这会有所帮助。