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

PaulconsultingAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Protocols

From novice to tech pro — start learning today.