[英]SMTPClient email sometimes going to Junk Mail
I'm having a difficult time understanding why email I send from my website by using SMTP is going to Outlook's junk mail. 我很难理解为什么我使用SMTP从我的网站发送的电子邮件会转到Outlook的垃圾邮件。 Here is my code:
这是我的代码:
Dim windowsLoginName As System.String = HttpContext.Current.User.Identity.Name
Dim split As String() = Nothing
Dim vname As String
'Get network login name (name only)
split = windowsLoginName.Split("\".ToCharArray)
vname = split(1)
'create the mail message
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress(vname & "@x.com")
mail.To.Add(txtWhoApproves.Text)
'set the content
Dim varstreason, vartxt, vartxt2, varbody As String
varstreason = DropDownList1.SelectedItem.Text
If TextBox1.Text = TextBox2.Text Then
If CheckBox1.Checked = True Then
varbody = TextBox3.Text & " has requested the following time off: " & System.Environment.NewLine & varstreason & " - " & TextBox1.Text & " - All Day"
Else
vartxt = varstreason & " - " & TextBox1.Text
vartxt2 = DropDownList2.SelectedValue & " to " & DropDownList3.SelectedValue
varbody = TextBox3.Text & " has requested the following time off: " & vartxt & " - " & vartxt2
End If
Else
varbody = TextBox3.Text & " has requested the following time off: " & varstreason & " - " & TextBox1.Text & " to " & TextBox2.Text
End If
mail.Subject = "Time Off Approval Requested"
mail.Body = varbody
'send the message
Dim smtp As New SmtpClient("(IP Address of email server)")
'to authenticate we set the username and password properites on the SmtpClient
'smtp.Credentials = New NetworkCredential("username", "secret")
smtp.Send(mail)
I have the email coming from whoever is logged onto the network. 我有来自登录网络的人的电子邮件。 Since it's multiple people, I remarked out smtp.Credentials because the password is different for each user (and changes periodically).
由于它是多个人,因此我将smtp.Credentials标记为空白,因为每个用户的密码不同(并且会定期更改)。 I'm thinking that this is somehow causing the email to sometimes go into the junk email.
我认为这某种程度上导致了电子邮件有时进入垃圾邮件。
And ideas? 有想法吗? How can I prevent these emails from going into junk?
如何防止这些电子邮件进入垃圾邮件? We are using an Exchange 2010 server, and Outlook 2007, 2010, or 2013. Thanks in advance!
我们正在使用Exchange 2010服务器和Outlook 2007、2010或2013。预先感谢!
可能是您的网站在Outlook安全系统中被列为垃圾邮件,或者您的电子邮件中包含一些垃圾邮件单词或链接,导致电子邮件进入垃圾邮件或垃圾邮件箱。
Spam filtering for email is based on the content of the subject, message, and attachments. 电子邮件的垃圾邮件过滤基于主题,邮件和附件的内容。 It also filters based on things such as what host/IP you're sending from.
它还会根据您发送的主机/ IP等信息进行过滤。 If you attempt to send an email via SMTP using a host such as gmail, you'll likely notice it will inbox.
如果您尝试使用gmail之类的主机通过SMTP发送电子邮件,您可能会注意到它将收件箱。
Based on your comments: 根据您的评论:
From here I would recommend 2 different solutions: 从这里我将推荐2种不同的解决方案:
First Solution: 第一个解决方案:
Instead of using your website's SMTP, instead use your Exchange server to send the email. 与其使用您网站的SMTP,不如使用您的Exchange服务器发送电子邮件。 This will work the same as joe@yourcompany.com sending an email to bob@yourcompany.com.
这将与joe@yourcompany.com发送电子邮件至bob@yourcompany.com相同。 The email will never need to leave the server or hit any filters(unless you set up internal filters), so it will not hit the spam box (unless an end user specifically sets it up this way).
电子邮件将永远不需要离开服务器或点击任何过滤器(除非您设置了内部过滤器),因此它将不会打入垃圾邮件框(除非最终用户专门以此方式进行设置)。 Check out this site for some help in how to accomplish this: https://www.emailarchitect.net/easendmail/kb/vbnet.aspx
请访问此站点以获取有关如何完成此操作的帮助: https : //www.emailarchitect.net/easendmail/kb/vbnet.aspx
Second Solution: 第二种解决方案:
Use group policies to add the email address to safe senders list for all your users.( https://social.technet.microsoft.com/Forums/office/en-US/c0714d7d-2a42-4b0f-9f1d-63234c7278a0/appending-outlook-safe-senders-list-via-gpo ) This seems like it should be an easy solution, but the issue is that it still may not work since you have 2 different servers using the same domain. 使用组策略将电子邮件地址添加到所有用户的安全发件人列表中。( https://social.technet.microsoft.com/Forums/office/en-US/c0714d7d-2a42-4b0f-9f1d-63234c7278a0/appending- Outlook的安全发件人列表,通过-GPO )这似乎是它应该是一个简单的解决方案,但问题是,它仍可能无法工作,因为你必须使用相同的域2台不同的服务器。 So although the address may be added in, Outlook may view it as being a different address since it is not coming from the Exchange server.
因此,尽管可以添加地址,但是Outlook可能会将其视为其他地址,因为它不是来自Exchange服务器。 The other option in this solution is to have everyone that gets your email to add it to safe senders directly from the email they receive.
此解决方案中的另一种选择是让每个收到您的电子邮件的人都直接从收到的电子邮件中将其添加到安全发件人。 That would do it, but hugely inefficient and manual.
那样就可以了,但是效率很低而且很手工。
For some more in-depth info into the processes and technology behind email, I would recommend checking out the "How Email Works" series of articles by Click-Z (part 1 - https://www.clickz.com/clickz/column/2411041/how-email-works-part-one-the-story-of-send ) 有关电子邮件背后的流程和技术的更多深入信息,我建议您查看Click-Z的“电子邮件如何运作”系列文章(第1部分-https: //www.clickz.com/clickz/column / 2411041 /如何通过电子邮件发送发送故事的一部分 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.