I have some code that sends an activation code to a user when they sign up for a service. Some people are not getting the email at all, even when they check their spam/bulk folder. After reviewing the mail server logs, ALL the emails were successfully sent via the SMTP service but some are just not being delivered.
Could the email provider be flagging this email as spam? Is there anything I can do to prevent this?
Dim strMailSubject As String
Dim strMailBody As String
strMailSubject = "Welcome"
Dim ToAddress As String = txtEmail.Text.Trim
Dim mm As New MailMessage("noreply@-------.com", ToAddress)
'Dim mm As New MailMessage(ToAddress, ToAddress)
mm.Subject = strMailSubject
strMailBody = "Dear " & Trim(lblFName.Text) & ","
strMailBody = strMailBody & "<BR><BR>Thank you for registering. To complete your registration, please follow the link below or just enter <b>" & lblActivationCode.Text & " </b>in the activate account form"
strMailBody = strMailBody & "<br><br>" & "<a href='http://" & Request.Url.Host & Request.ApplicationPath & "/Verify.aspx?UserID=" & sUserID & "&ActivationCode=" & lblActivationCode.Text & " '>" & "http://" & Request.Url.Host & Request.ApplicationPath & "/Verify.aspx?UserID=" & sUserID & "&ActivationCode=" & lblActivationCode.Text & "</a>"
mm.Body = strMailBody
mm.IsBodyHtml = True
Dim smtp As New SmtpClient
lblError.Visible = False
pnlSucess.visible = True
Catch ex As Exception
Me.pnlError.Visible = True
lblError.Visible = True
lblError.Text = "<li>" & ex.ToString & "</li>"
lblError.Text = lblError.Text & "<li>We are currently having trouble processing your email. Please check that your email address is correct. If problem persists, please try again at a later time.</li>"