[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 385
  • Last Modified:

Emails from my VDS being sent to gmail's spam

Hello Pros,

I have a Virtual dedicated server at myhosting.com . And recently the emails which are sent from domains which are on my VDS are being treated as spam on Gmail. I send them using System.Net.Mail as you can see in the code below. Is there anyway to make the mails so they wont go to spam at gmail? (Yahoo does not send them to span by the way)

Thanks in advance
public bool SendEmail(string strTo, string strFrom, string thebody, string theSubject)
    {
        MailAddress addrFrom = new MailAddress("cards@card-boutique.com", "card-boutique.com");
        MailAddress addrTo = new MailAddress(strTo);
        MailMessage objMM = new MailMessage(addrFrom, addrTo);

        string bodyToSend;

        bodyToSend = thebody;

        objMM.Subject = theSubject;
        objMM.Body = bodyToSend;
        objMM.IsBodyHtml = true;
        objMM.BodyEncoding = System.Text.Encoding.GetEncoding("UTF-8");

        SmtpClient smtp = new SmtpClient();
        smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;

        try
        {
            smtp.Send(objMM);
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
    }

Open in new window

0
sagir
Asked:
sagir
  • 3
  • 2
1 Solution
 
Neil RussellTechnical Development LeadCommented:
You need to identify WHY gmail classifies them as spam first.  The code you have posted only sends the email, doesnt tell us anything at all.  
Look at the headers of an email that gmail has put in the spam folder and identify WHY it is spam.
Have you checked that your server is NOT on any blocklists anywhere?
0
 
sagirAuthor Commented:
Here is one of the headers of the mails that were sent to spam:

Delivered-To: kalika.anna@gmail.com
Received: by 10.231.16.203 with SMTP id p11cs34264iba;
        Sun, 22 Aug 2010 11:54:24 -0700 (PDT)
Received: by 10.231.156.65 with SMTP id v1mr5283998ibw.107.1282503264547;
        Sun, 22 Aug 2010 11:54:24 -0700 (PDT)
Return-Path: <cards@card-boutique.com>
Received: from xsmtp01.mail2web.com (xsmtp01.mail2web.com [168.144.250.211])
        by mx.google.com with ESMTP id x7si13266048ibd.70.2010.08.22.11.54.24;
        Sun, 22 Aug 2010 11:54:24 -0700 (PDT)
Received-SPF: neutral (google.com: 168.144.250.211 is neither permitted nor denied by best guess record for domain of cards@card-boutique.com) client-ip=168.144.250.211;
Authentication-Results: mx.google.com; spf=neutral (google.com: 168.144.250.211 is neither permitted nor denied by best guess record for domain of cards@card-boutique.com) smtp.mail=cards@card-boutique.com
Message-Id: <4c717260.8725e70a.302c.ffffdbc8SMTPIN_ADDED@mx.google.com>
Received: from [168.144.18.49] (helo=VPS-930)
      by xsmtp01.mail2web.com with esmtp (Exim 4.63)
      (envelope-from <cards@card-boutique.com>)
      id 1OnFgT-00063F-8x
      for kalika.anna@gmail.com; Sun, 22 Aug 2010 14:54:24 -0400
MIME-Version: 1.0
From: card-boutique.com <cards@card-boutique.com>
To: kalika.anna@gmail.com
Date: 22 Aug 2010 14:54:21 -0400
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
Subject: =?utf-8?B?c2FnaXJvZGluQGdtYWlsLmNvbSDXqdeS15nXkCwg16nXnNeXINec15og15HXqNeb15Q=?=
0
 
Kamal KhaleefaInformation Security SpecialistCommented:
you have to add SPF Record
ask the domin controller to add it for you

neutral (google.com: 168.144.250.211 is neither permitted nor denied by best guess record for domain of cards@card-boutique.com) client-ip=168.144.250.211;
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sagirAuthor Commented:
king2002:
My domain is controlled in GoDaddy and I have an A-Record pointing to my VDS which is not on GoDaddy. How and where should I set the SPF record (And what should be it's value)?

Thanks
0
 
Kamal KhaleefaInformation Security SpecialistCommented:
A good tool for this would be http://www.kitterman.com/spf/validate.html

I would recommend that you use a SPF such as "v=spf1 -all" . Please take a look at http://www.openspf.org/ as this provides a wizard for creating SPF records. You should cross check any SFP you create with the above validation link.


for me i let my domain hosting (the planet)
add it for me
also you have to check for domain keys
0
 
sagirAuthor Commented:
king2002:

So on the above example as you can see on the email header, the server from which the email are being sent is 168.144.250.211 . So I should just add it in the ip4 section and that's it?
I get this record generated: v=spf1 ip4:168.144.250.211 a ~all

and the test result comes back:

Input accepted, querying now...
evaluating v=spf1 ip4:168.144.250.211 a ~all ...
SPF record passed validation test with pySPF (Python SPF library)!

is this it? just add it on my GoDaddy domain manager and I am done?

Thanks a lot.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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