• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1345
  • Last Modified:

Sending Email using System.Net.Mail

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)
        Try
            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
            smtp.Send(mm)
            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>"
 
        End Try

Open in new window

0
Paulconsulting
Asked:
Paulconsulting
  • 3
  • 2
1 Solution
 
pjcooleCommented:
If the email is successfully sent out by your SMTP server then the problem is not on your side.  The recipient server may be flagging it as spam.  You will have to contact the Admin on the recipient side to track down why the email was not delivered.  If this problem happens often you may want to check your DNS settings and verify your domain/smtp server is not on any black lists.

try these sites: http://www.mxtoolbox.com/blacklists.aspx

http://www.intodns.com/
0
 
prairiedogCommented:
>>>Could the email provider be flagging this email  as spam?
Very likely.
>>>Is there anything I can do to prevent this?
Yes, but not much.
"Welcome" is not a very good subject and might be caught as a spam. Try something like "Activation code for your registration". Bottom line: be more specific and more informative, so it will have more chances to pass the spam filter.
0
 
PaulconsultingAuthor Commented:
Thanks, I ran the mail server IP and domain name with those tools you suggested and everything checked out ok, any other suggestions? My co-worker suggested researching email headers.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
PaulconsultingAuthor Commented:
Thanks for the suggestion prairiedog, I will give that a try.
0
 
prairiedogCommented:
Two other things I can think of is to format your email in a professional way and to inform users to add your email address to their address book.
Researching email header might help as well, but I don't know much about it.
0
 
PaulconsultingAuthor Commented:
After changing the body content and subject, adding a couple of email headers and adding a true "from" address we passed the spam filter
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now