Limit SMTP Size Properly

In your company, VIP users are allowed to send unlimited outgoing message size; however for other ordinary users, you must set some limit for outgoing message size. To make it more complex, for local mail sending, both VIP users and ordinary users can send whatever messages with no size limitation. How to do that??

Initially, the basic requirement was simple, I need to configure MDaemon to limit outgoing message size for all users, that's it. However, I did it wrongly *sigh*. Interestingly, there are many people do the same mistake or ask how to do it in the mailing list.

First attempt, I used the setting "Maximum acceptable SMTP message size" in Setup - Miscellaneous Options - Servers tab.

Figure 1: Maximum acceptable SMTP message size

It seemed correct, whenever I tried to send a message with attachment larger than the size specified, MDaemon rejected it properly. Then I was confidently applied the configuration to the Primary Mail Server. After monitoring the log, I found out that MDaemon rejected the incoming messages larger than the size specified. Yikes !! Finally I knew that the setting covered both incoming and outgoing messages, I thought Alt+N should highlight the impact of some 'dangerous' settings, either in the Online Help or the application itself.

The second attempt, I used the Content Filter to do the job. It was quite simple, the steps were:

  1. Click menu Security - Content Filter
  2. Click New Rule button
  3. Type the rule name, i.e. Limit SMTP Size
  4. Tick the option "If the MESSAGE SIZE is greater than"
  5. Click the underlined blue link in the Rule Description for "is greater than '10K'" and type the maximum SMTP Size you want to use, then click Ok
  6. Tick the option "Send a note 1 to ..."
  7. Click the underlined blue link in the Rule Description for "specify information" and type "$SENDER$" in To editbox, "[REJECTED] $SUBJECT$" in Subject editbox, and type whatever informational message in the Message Text; if necessary, tick "Include the original message", then click Ok
  8. Tick the option "Delete the message"
  9. Click Ok to create the rule

Figure 2: New Content Filter to limit SMTP Size

Figure 3: Send notification to sender along with the original message

Ordering is very important in determining the steps of actions taken in Content Filter. If you tick "Delete the message" first, then tick "Send a note 1 to ...", the sender will never receive a notification because the message is deleted already. Please ensure the option ticking is done in order.

After checking the result, I reconsidered the configuration once again. I remembered the purpose of limiting outgoing messages size is to minimize the bandwidth usage. Thus local mail sending should not be limited. I made a small changes, to apply the Content Filter rule only to Remote Queue. I just reopened that Content Filter rule, then clicked the underlined blue link for "LOCAL & REMOTE", then unticked "Local Queue" and click Ok

Figure 4: Apply the rule for Remote Queue only

Now after the rule was applied, I had a lot of complains from VIP users, that they could not send messages with some attachments. Then I made the forth attempt, by allowing VIP users to send message with no limit. The steps were:

  1. Click menu Security - Content Filter
  2. Click New Rule button
  3. Type the rule name, i.e. Allow unlimited SMTP Size for VIP Users
  4. Tick the option "If the FROM HEADER contains"
  5. Click the underlined blue link in the Rule Description for "contains specific strings" and type the e-mail address of the VIP users, click "Add" button. If you specify more than one e-mail address, then you have to change the logical connector from "AND" to "OR" by click the underlined blue link and select "Any", then click Ok.
  6. Tick the option "Skip the next 'n' rules" and specify 1 (by clicking the underlined blue link)
  7. Click Ok to create the rule
  8. Click "Move Up" button to make this rule prior to the rule we created before.

Since we configured to skip 1 rule if the messages were sent from VIP users, then we had to put this rule prior to the rule to delete large messages. The failure of doing this will make VIP users cannot send large messages.

Figure 5: Skip the rule for message from VIP Users

Figure 6: Specify the VIP Users List

Figure 7: Remember to specify "Any" to make "OR" logical connector to be used

Figure 8: Remember to use the proper order for both rules

Hopefully you can now limit the size of outgoing messages while keeping your VIP users satisfied of getting unlimited size :-)