Adjusting Spam Settings in SmarterMail Enterprise 9.4

Every day, millions of unwanted spam messages are sent throughout the Internet.  I would venture to say that most people find them annoying but may not know that they can do something about it.  Fortunately, most email software available now come with some sort of spam filtering mechanism.  In this tutorial, I am only going to cover how to tweak the settings in SmarterMail Enterprise 9.4 because each spam filtering software works differently.

First of all, you’ll need to understand that there are three levels (server, domain, user) of spam filtering within SmarterMail.  If you are using SmarterMail from a hosting provider, you will probably not have access to adjust the settings at the server level, but you should have access to adjust the settings at the domain and user levels.  When you adjust the settings at the domain level, they will apply to all new email accounts created from the point you changed the settings.  If you change it at the user level, it should take effect immediately on that email account.  To adjust the settings at the domain level, you’ll need to log into SmarterMail with an email account that has Administrator access (usually postmaster).  Let’s start by logging into SmarterMail.  On the menu to your left, click on the Settings icon (looks like 2 cogs) which will bring up a Settings menu like the one below.

SmarterMail Spam Filtering Options

To adjust the settings at the user level, make sure you click on the Spam Filtering link under My Settings -> Filtering -> Spam Filtering.  To adjust the settings at the domain level, make sure you click the Spam Filtering link under Domain Settings -> Filtering -> Spam Filtering.  (Note that this option will not be available if you did not log in with an email account that has Administrator privileges.)  In the Spam Filtering window on your right, click on the Options tab and select Override spam settings for the domain.  Now, click on the Current Weights tab, and you should see this screen.

SmarterMail Spam Filtering Current Weights

On this page is a list of the criteria SmarterMail will use to score an email message and flag it as spam.  This will make more sense if you review the headers of an email message.  To review a header, click on the Email icon (looks like an envelope) on the menu to your left.  (Make sure you do this before making adjustments, otherwise, click on the Save button to save your current changes.)  Then click on the Inbox and select an email message.  All the way on the bottom right hand corner, click on the Header tab which should bring up a screen like the one below.

SmarterMail Email Headers

These are the two tags you want to pay attention to:

X-SmarterMail-Spam
X-SmarterMail-TotalSpamWeight

And here is an example of the complete lines from the header:

X-SmarterMail-Spam: SPF_None, SpamAssassin 5 [raw: 1], DK_None, DKIM_None
X-SmarterMail-TotalSpamWeight: 5

You’ll notice that these tags correlate directly with the criteria and values under Current Weights.  The total spam weight is determined by the sum of the criteria checked and values assigned to each criteria.  For example:

SPF_None (value 0)  + SpamAssassin 5 [raw: 1] (value 5) + DK_None (value 0) + DKIM_None (value 0) or 0 + 5 + 0 + 0 which equals 5.

You may notice that a criteria may be missing from your list such as SpamAssassin in this case.  That’s because it’s a criteria set by your mail server administrator at the server level which has not been delegated to you to adjust but will still affect the final calculation of the spam score.  It allows mail server administrators to configure a minimum thresh hold for spam filtering because turning it off completely could put too much of a burden on a server to process all the messages sent and flood users’ Inboxes with unwanted spam.  Note that DK_None actually corresponds to DomainKeys None and is just abbreviated. If you want to change the score of a message, then you need to assign different values to the criteria under Current Weights to change the outcome of the total spam weight.  (You can enter negative numbers which implies a positive scoring.)  Ultimately, the number you need to pay attention to is X-SmarterMail-TotalSpamWeight.  Now, let’s go back to the Spam Filtering settings page and click on the Actions tab.

SmarterMail Actions

On this page, you can direct SmarterMail to take one of three actions if the total spam weight equals or exceeds the values listed:

Delete Message
Move to Junk E-mail Folder
Add Text to Subject

Since we know the total spam weight of a message by viewing the headers, we can adjust the values here and select actions that will process the messages accordingly.  By changing the values under the Current Weights and Actions tabs, you can control the flow of spam messages into your email account so that they will at least not clutter up your Inbox. Make sure you also remember to click on the Save button to apply the changes you made, otherwise, they will not take effect.  There may be a lot of trial and error to get the settings just right to your liking.  Since no system is perfect, I would recommend not using the Delete Message action in case the filtering system flags a legitimate email incorrectly.  Even if you are confident that you have finally adjusted the settings correctly, I would still recommend that you don’t use the Delete Message action in case your mail server administrator decides to make tweaks at the server level which may throw off your own settings later.  Don’t worry, good mail server administrators won’t do this arbitrarily.  Remember, they are on your side.  They make these adjustments if they see an increase of spam activity on the server.  Their server level adjustments form a “baseline” for filtering spam messages, and their job is more difficult since they have to balance trying to capture a majority of the spam that reaches the server while allowing legitimate email messages through.  This is where further refinement must be done by you at the domain and user levels.

I also mentioned before that if you made the adjustments at the domain level, the settings will only be applied to new email accounts that are created.  Fortunately, there is a tool within SmarterMail that you can use to apply the changes you made at the domain level to existing email accounts.  Click on the Settings icon and navigate to Domain Settings -> Advanced Settings -> User Propagation by expanding the folders.  In the Options tab, select All Users or the individual email account in the drop down box next to Propagate To.  When you’re ready, click on the Propagate Now button to apply the changes to other existing email accounts.  Please note that the changes are not retroactive (i.e. they will not apply to existing email, only new incoming email).

SmarterMail User Propagation

That’s it.  You are now equipped and ready to deal with spam on your own terms.

My Two Cents on Where to Add Google Analytics in WordPress

There are already enough blogs out there with tutorials on how you can add Google Analytics to your WordPress site.  I won’t bother repeating that information here, but I wanted to add my 2 cents to the discussion.  If you plan to add the tracking code manually, Google actually instructs you to place it right before the HTML header closing tag (i.e. </head>), but I recommend you place it right before the HTML body closing tag (i.e </body>).  Why?  Because while hand coding another website and using Google’s own PageSpeed tool which provides optimization recommendations, it says I should defer the parsing of JavaScript in order to improve performance (i.e load time).  And that’s really easy to do if you’re using one of the default themes.  Just go to Appearance -> Editor and click on the Footer link (i.e. footer.php) on your right.  Scroll all the way to the bottom and place the Google Analytics tracking code right in between the <?php wp_footer(); ?> and </body> tags.  Then click on the Update File button.

WP-Footer

Determining Which Table is the Largest in a Microsoft SQL Server Database

One of our customers for my company asked a great question today.  She wanted to know why her SQL Server database was filling up so fast even though she hadn’t added much content to her website and thought there was a problem on our end.  She had increased the database size a couple hundred megabytes each time, and it filled up in a few hours.  Of course this didn’t sound right to me, and to find out what was happening, I knew I had to iterate through each table to find the size and get an idea of what might be going on.  Being busy and lazy, I searched the Internet for a quick solution but didn’t find any, so I decided to go to lunch.  I figured that I would sit down and work through the problem later, but when I got back from lunch, my coworker figured it out and shared the solution with our staff which I will now share with you.  It’s a few T-SQL statements which can be executed in a query window.  You create a temp table, populate it by using the sp_msforeachtable stored procedure and then query it to find the result.

CREATE TABLE #Temp (
  name nvarchar(128),
  [rows] char(11),
  reserved varchar(18),
  data varchar(18),
  index_size varchar(18),
  unused varchar(18)
)

INSERT INTO #Temp
EXEC sp_msforeachtable 'sp_spaceused ''?'''

SELECT TOP 1 * FROM #Temp
ORDER BY CAST(REPLACE(reserved,' kb','') AS int) DESC

That’s it.  The query above will tell you which table is the largest in the database.  With it, my coworker found out that there was a logs table and was able to inform our customer that something in her application was causing this table to fill up very fast.