SpamAssassin Integration

The integration with SpamAssassin allows you to subject your email to the SpamAssassin logic to see how it would score. A high score means that parts of the email are likely to be identified as spam by email servers and the email is more likely to be rejected.

You must use the web service API to get an email's SpamAssassin score. You make an API call with the email to test and the system responds with a message that contains the following elements:

  • The SpamAssassin score
  • The threshold score that defines when an email is considered spam
  • A yes/no indicator of whether the score exceeded the threshold
  • A detail message with information about what parts of the email caused the score to go up

You must be an API customer of ExactTarget to utilize SpamAssassin, and you must use an existing email and subscriber list as part of the test.  For best results, set up a test subscriber list you can use to evaluate the email without risk of a premature send to your existing subscribers. This API call will work with dynamic content, but it does not work with data extensions.

Results will display based on the user interface your company has set up to receive information from the API call. You can set the spam threshold score to be more or less stringent that the SpamAssassin default, depending on your needs. The validation information will return up to 1 minute following the call's send.

SpamAssassin Best Practices

ExactTarget recommends that emails return a score of 3.0 or lower from a SpamAssassin check in order to get past the majority of SpamAssassin installations. The SpamAssassin rules listed below represent common errors that can be easily corrected, causing your SpamAssassin score to decrease.

MIME_HTML_ONLY

Mail sent as HTML only can cause a 1.9 point increase to your email's SpamAssassin score. Make sure to send your emails with multi-part MIME enabled. Contact your ExactTarget representative for more information on the multi-part MIME feature.

HTML_IMAGE_RATIO

Emails containing a large number of images or a low ratio of text to images may incur a .2 to .9 point increase to the SpamAssassin score. To correct this issue, include more text in your emails or reduce the size and number of your images.

HTML_TAG_BALANCE_BODY

Failing to close the <body> tag in your HTML email earns your email a 1.1 increase on your SpamAssassin score. Be sure to close all tags in your email, including the <body> tag.

DEAR_FRIEND

Avoid using the phrase "dear friend" in your email, as it earns the email a 2.7 point increase. Spam messages commonly include this phrase.

FROM_OFFERS

Avoid including the word "offers" in your email address. This increase an email's SpamAssassin score by 2.7 points. Use a real, valid email address as part of your email send to avoid this problem.

HTML_FONT_LOW_CONTRAST

If an email's font color is similar to the email's background color, the SpamAssassin score may increase by .7 points. Increase the contrast between font and background to avoid this problem.

Perform Call to Validate SpamAssassin Check

///<summary>
        /// Spam Assassign should always be performed using ASync call. If you are using Synchronous you will
        /// experience timeouts.
        ///
        /// Once you make API call, capture RequestId and then use that to Retrieve details of SPAM check uisng
        /// ResultMessage. ResultMessage returns XML data in ResultDetailXML property. Clients have to process that XML string
        /// and identify score inside it.
        ///</summary>
        public void testCheckforSpam()
        {
            ContentValidation validation = new ContentValidation();
            validation.ValidationAction = new SpamAssassinValidation();
            ;

            Email email = new Email();
            email.ID = 3756825;
            email.IDSpecified = true;

            validation.Email = email;
            //Subscriber should exists in ALL subscribers, Otherwise system will not work.
            //Spam Assassin will work only with List based subscribers. Not supported for DataExtension subscribers.
            Subscriber subscriber = new Subscriber();
            subscriber.EmailAddress = "g_bhargav@gmail.com";


            Subscriber[] subscribers = {subscriber};
            validation.Subscribers = subscribers;
            APIObject[] validationObjs = {validation};
            PerformResult[] results = null;

            String requestId = null;
            String OverallStatus = null;
            String OverallStatusMsg = null;
            PerformOptions options = new PerformOptions();
            options.RequestType = RequestType.Asynchronous;
            options.RequestTypeSpecified = true;

            results =
                soapClient.Perform(options, "Validate", validationObjs, out OverallStatus, out OverallStatusMsg,
                                   out requestId);
            if (results != null)
            {
                Console.Write("Results :: " + results);
            }
        }

Check for SpamAssassin Score 

///<summary>
        /// Retrieve ResultMessage Object.
        ///</summary>
        public void testRetrieveResultMessage()
        {
            APIObject[] results;
            RetrieveRequest rr = new RetrieveRequest();
            rr.ObjectType = "ResultMessage";
            rr.Properties = new string[] { "StatusMessage", "ErrorCode", "RequestType", "ResultDetailXML" };
            SimpleFilterPart filter = new SimpleFilterPart();
            filter.Property = "RequestID";
            filter.SimpleOperator = SimpleOperators.equals;
            filter.Value = new string[] { "f53b06d7-6186-4491-989c-bbf160616cd1" };

            rr.Filter = filter;

            // Execute RetrieveRequest
            String status = soapClient.Retrieve(rr, out requestID, out results);

            // Output the Values
            Console.WriteLine(status);
            Console.WriteLine(requestID);
            Console.WriteLine(results.Length);
            Console.WriteLine("_________Properties______________");
        }

 

SOAP Response for ResultMessage

<soap:Body>
      <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>OK</OverallStatus>
         <RequestID>b08956a2-9acc-44d9-8376-fec6f8aaa62e</RequestID>
         <Results xsi:type="ResultMessage">
            <PartnerKey xsi:nil="true"/>
            <CreatedDate>2009-07-29T21:00:27.453</CreatedDate>
            <ObjectID xsi:nil="true"/>
            <StatusMessage/>
            <RequestType>Asynchronous</RequestType>
            <ResultType>ContentValidationResult</ResultType>
            <ResultDetailXML><![CDATA[<ContentValidationResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://exacttarget.com/wsdl/partnerAPI"><StatusCode>OK</StatusCode><Object xsi:type="ContentValidation"><PartnerKey xsi:nil="true" /><ObjectID xsi:nil="true" /><ValidationAction xsi:type="SpamAssassinValidation" /><Email><PartnerKey xsi:nil="true" /><ID>2744229</ID><ObjectID xsi:nil="true" /></Email><Subscribers><Subscriber><PartnerKey xsi:nil="true" /><ID>378445620</ID><ObjectID xsi:nil="true" /><EmailAddress>gbhargav@gmail.com</EmailAddress><Lists><PartnerKey xsi:nil="true" /><ID>881272</ID><ObjectID xsi:nil="true" /></Lists></Subscriber></Subscribers></Object><Task xsi:type="ContentValidationTaskResult"><StatusCode /><StatusMessage /><ID>e076ffda-575c-496b-a1d5-9f51629e4d35</ID><ValidationResults><ValidationResult><Subscriber><PartnerKey xsi:nil="true" /><ID>378445620</ID><ObjectID xsi:nil="true" /><EmailAddress>gbhargav@gmail.com</EmailAddress><Lists><PartnerKey xsi:nil="true" /><ID>881272</ID><ObjectID xsi:nil="true" /></Lists></Subscriber><IsResultValid>true</IsResultValid><IsSpam>false</IsSpam><Score>-1.4</Score><Threshold>5</Threshold><Message /></ValidationResult></ValidationResults></Task></ContentValidationResult>]]></ResultDetailXML>
         </Results>
      </RetrieveResponseMsg>
   </soap:Body>
Tag page
You must login to post a comment.