如何避免以vb.net HTML格式的邮件发送垃圾邮件 [英] How to avoid spam mail in vb.net HTML Format Mail
本文介绍了如何避免以vb.net HTML格式的邮件发送垃圾邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Imports System.Net.Mail
Shared Function sendMail(ByVal fromName As String, ByVal from As String, ByVal rcpt As String, ByVal subject As String, ByVal body As String, ByVal isBodyHTML As Boolean, ByVal BCCRcpt As String) As Boolean 'Returns True if send ok, False if errors
Dim pEmailMessage As New MailMessage
Dim pSmtpClient As New SmtpClient
Dim pSmtpServer As String
Dim pSmtpUser As String
Dim pSmtpPass As String
Dim pMailServerUser As String
pSmtpServer = "chnexc001.gavsin.com"
pMailServerUser = String.Empty
pSmtpUser = "root"
pSmtpPass = "draddots"
pEmailMessage.From = New System.Net.Mail.MailAddress(from, fromName)
If rcpt <> String.Empty Then
pEmailMessage.To.Add(rcpt)
End If
If BCCRcpt <> String.Empty Then
pEmailMessage.Bcc.Add(BCCRcpt)
End If
pEmailMessage.Subject = subject
pEmailMessage.Body = body
pEmailMessage.IsBodyHtml = isBodyHTML
pEmailMessage.Priority = System.Net.Mail.MailPriority.Normal
pSmtpClient.Host = pSmtpServer
If Trim(pSmtpUser) <> "" Then
pSmtpClient.Credentials = New System.Net.NetworkCredential(pSmtpUser, pSmtpPass)
End If
Try
pEmailMessage.IsBodyHtml = True
pSmtpClient.Send(pEmailMessage)
sendMail = True
Catch ex As Exception
sendMail = False
End Try
End Function
推荐答案
如果您尝试避免使用客户端垃圾邮件过滤器,则将无法进行设置,因为这些设置几乎完全是在客户端配置的,每个用户都可以根据需要对其进行自定义.
这就是为什么您在这里的论坛上看到邮件的原因,人们正在那里看到他们的邮件更新等,并指示他们更新垃圾邮件筛选器以允许CP邮件通过.如果可以从服务器端完成,那么我很确定这将是一个可以实现这一目标的站点.
If you are trying to avoid a client spam filter, you won''t be able to as those settings are pretty much entirely configured on the client side and each user can customize it however they please.
That is why you see messages on the forums here where people are seeing their mail updates, etc. and they are being directed to update their spam filters to allow the CP mails through. If it could be done from the server side, I''m pretty sure this would be one site that would pull it off.
首先,没有人会阅读所有这些代码. br/>
其次,无论您做什么,都无法避免客户端垃圾邮件过滤器.
尝试这样做可能会使您也入狱一段时间!祝你玩得开心!
First, noone is going to read all that code.
Second, you cannot avoid a clients spam filter, no matter what you do.
Attempting to do so will probabyl get you some time in prison too! Have a nice time!
这篇关于如何避免以vb.net HTML格式的邮件发送垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文