<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Spam Archives - SurgeMail</title>
	<atom:link href="https://surgemail.com/article-categories/spam/feed/" rel="self" type="application/rss+xml" />
	<link>https://surgemail.com/article-categories/spam/</link>
	<description>Windows/Linux Mail Server Software</description>
	<lastBuildDate>Wed, 19 Jun 2024 22:01:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.1</generator>

<image>
	<url>https://surgemail.com/wp-content/uploads/2019/11/cropped-robot_80-32x32.png</url>
	<title>Spam Archives - SurgeMail</title>
	<link>https://surgemail.com/article-categories/spam/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Sending Email to avoid Spam Filters - best practices.</title>
		<link>https://surgemail.com/knowledge-base/sending-email-to-avoid-spam-filters-best-practices/</link>
		
		<dc:creator><![CDATA[chrisp]]></dc:creator>
		<pubDate>Wed, 12 Feb 2020 21:18:59 +0000</pubDate>
				<guid isPermaLink="false">https://surgemail.com/?post_type=ht_kb&#038;p=1466</guid>

					<description><![CDATA[<p>The short answer is there is no simple answer to prevent your outgoing email from being classified as spam. However, these are the critical steps/best practices to achieve this in the long term. Guard your servers reputation by quickly addressing any issue with outgoing spam. Create an SPF entry for your domain Create / enable<br /><a class="moretag" href="https://surgemail.com/knowledge-base/sending-email-to-avoid-spam-filters-best-practices/">+ Read More</a></p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/sending-email-to-avoid-spam-filters-best-practices/">Sending Email to avoid Spam Filters - best practices.</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>The short answer is there is no simple answer to prevent your outgoing email from being classified as spam.  However, these are the critical steps/best practices to achieve this in the long term.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<ul class="wp-block-list"><li>Guard your servers reputation by quickly addressing any issue with outgoing spam.</li><li>Create an SPF entry for your domain</li><li>Create / enable DKIM signatures for your domain, add DNS entries for these.</li><li>Make sure you g_send_helo setting is correct: mail.your.server and the reverse dns of your ip address points to this name  mail.your.server -&gt; 1.2.3.4 -&gt; mail.your.server</li><li>Enable SurgeMail's features to prevent/detect hackers early.</li><li>Monitor and remove your server from RBL listings, primarily by stopping any spamers sending on your system.</li><li>Use SurgeMail's config checker - it will help with many of the above suggestions. </li></ul>
</div></div>



<p></p>



<p>With some large providers you can sign up for reporting to find out details about spam reports from their users related to you. Here's the one for outlook / Microsoft.</p>



<ul class="wp-block-list"><li><a href="https://postmaster.live.com/snds/JMRP.aspx">https://postmaster.live.com/snds/JMRP.aspx</a></li></ul>



<h3 class="wp-block-heading">How to define an SPF record for my domain</h3>



<p>Add this as a 'txt' record for you email domain, e.g. example.com &nbsp;</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<p>    v=spf1 ip4:1.2.3.4/24 a mx -all   </p>



<p>(Replace 1.2.3.4, and mail.your.domain, with your details) This DNS entry goes into your dns server under the name 'YOUR.DOMAIN' as a 'TXT' record.</p>
</div></div>



<p>In addition you should probably add a DMARC record to tell other servers to enforce spf for your domain:</p>



<pre class="wp-block-preformatted">So add the dns entry:  _dmarc.<strong>your.domain</strong>
A  'txt' record containing:     "v=DMARC1; p=reject; aspf=r; adkim=r"
</pre>



<figure class="wp-block-table"><table><tbody><tr><th>&nbsp; Token</th><th>Explanation</th></tr><tr><td>v=spf1</td><td>Version of SPF syntax</td></tr><tr><td>ip4:1.2.3.4/24</td><td>Allow any ip address 1.2.3.0-1.2.3.255 (change to match your own mail server ip address)</td></tr><tr><td>a</td><td>Allow any ip which matches the IP address of this domain (doing a simple 'a' lookup)</td></tr><tr><td>mx</td><td>Allow any ip which matches the IP address of a mail server that accepts incoming mail for this domain.</td></tr><tr><td>-all</td><td>Block any mail from an ip other than those listed above</td></tr></tbody></table></figure>



<h3 class="wp-block-heading">Turn on DKIM</h3>



<figure class="wp-block-embed is-type-wp-embed is-provider-surgemail wp-block-embed-surgemail"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="p88Y6c2u9p"><a href="https://surgemail.com/knowledge-base/dkim-domainkeys/">DKIM / DomainKeys</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;DKIM / DomainKeys&#8221; &#8212; SurgeMail" src="https://surgemail.com/knowledge-base/dkim-domainkeys/embed/#?secret=p88Y6c2u9p" data-secret="p88Y6c2u9p" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<p></p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/sending-email-to-avoid-spam-filters-best-practices/">Sending Email to avoid Spam Filters - best practices.</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Find and stop spammers and hackers</title>
		<link>https://surgemail.com/knowledge-base/find-and-stop-spammers-and-hackers/</link>
		
		<dc:creator><![CDATA[chrisp]]></dc:creator>
		<pubDate>Sun, 02 Feb 2020 22:44:10 +0000</pubDate>
				<guid isPermaLink="false">https://surgemail.com/?post_type=ht_kb&#038;p=1429</guid>

					<description><![CDATA[<p>A quick guide on how to find the hacked accounts, and prevent this re-occurring. Upgrade to our current release Find the hacked account. Use this command to list the top senders, usually the last 1-2 listed will be the hacked accounts. tellmail send_top Next examine msg*.rec log entries for these accounts, and find the 'Subject'<br /><a class="moretag" href="https://surgemail.com/knowledge-base/find-and-stop-spammers-and-hackers/">+ Read More</a></p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/find-and-stop-spammers-and-hackers/">Find and stop spammers and hackers</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>A quick guide on how to find the hacked accounts, and prevent this re-occurring.</p>



<h2 class="wp-block-heading">Upgrade to our current release</h2>



<ul class="wp-block-list">
<li>Download the latest release</li>



<li>Use the config checker in the web admin tool and apply recommended settings.</li>
</ul>



<h2 class="wp-block-heading">Find the hacked account.</h2>



<ul class="wp-block-list">
<li>tellmail send_top</li>



<li>tellmail showq</li>



<li>search rbl website <a href="http://multirbl.valli.org/">http://multirbl.valli.org/</a></li>
</ul>



<p>Use this command to list the top senders, usually the last 1-2 listed will be the hacked accounts.</p>



<pre class="wp-block-preformatted">tellmail send_top</pre>



<p>Next examine msg*.rec log entries for these accounts, and find the 'Subject' of the sent messages, does it look like spam? If so disable the accounts in question (or change their passwords).</p>



<p>Next use:</p>



<pre class="wp-block-preformatted">tellmail showq</pre>



<p>This will list message waiting to send, again this may help you identify problem messages/senders. </p>



<p>You may wish to use the command 'tellmail delete_contains SOMESPAMCONTENT' to delete queued messages that the spammer was trying to send.</p>



<p>Lastly search an RBL website to see if you have been blacklisted, if so, then for each blacklisting you need to contact the rbl and ask to be removed (at least for those that are not automatic).</p>



<p><a href="http://multirbl.valli.org/">http://multirbl.valli.org/</a></p>



<h2 class="wp-block-heading">Check for accounts with weak passwords</h2>



<pre class="wp-block-preformatted">Lastly you should run this command to find any accounts with trivially crackable passwords.

&nbsp;&nbsp;&nbsp; tellmail test_weak

We've built a faster more extensive password checker into nwauth, if you have the latest version of it you can do this:
&nbsp;&nbsp;&nbsp; nwauth -version
&nbsp;&nbsp;&nbsp; +OK nwauth 4.3e capa=cluster2&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; nwauth -testweak
&nbsp;&nbsp;&nbsp; +DATA Info: testing for 999 common passwords, pass 1
&nbsp;&nbsp;&nbsp; +DATA Cracked: crack2@xyz.com
&nbsp;&nbsp;&nbsp; +DATA Info: testing for variations on common passwords, pass 2</pre>



<p>Settings to enforce better passwords:</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<p>g_create_pass_digit "true"</p>



<p>g_hack_touser "true"</p>



<p>g_create_pass_recheck "true"</p>



<p>g_create_pass_mixed "true"</p>
</div></div>



<p></p>



<h2 class="wp-block-heading">Stop phishing!</h2>



<p>Add this setting: Version 7.6 required.</p>



<pre class="wp-block-code"><code>setting g_phish_block "true"</code></pre>



<p>This will replace url's in messages that are 'not' from friends, with a link that goes to your own mail server and warns the user not to proceed, the warning page then gives them the original link, and two links to websites to analyze the link. As well as a button to whitelist that domain in future.</p>



<h2 class="wp-block-heading">Find forwarding accounts</h2>



<p>Use this command to find all user accounts with a forwarding setting, these could result in your server being blacklisted and should be inspected or removed.</p>



<pre class="wp-block-preformatted">tellmail find_users "*" fwd "*"</pre>



<h2 class="wp-block-heading">Register for feedback.</h2>



<p>Some systems like Google/Yahoo etc may allow you to register to get reports of spam coming from your server, registering with these services will give you a good heads up on details of the spam and make it much easier to resolve the origin account on your system. </p>



<h2 class="wp-block-heading">Reading msg*.rec log entries.</h2>



<pre class="wp-block-preformatted">Log entries for an incoming message look like this:<br><a href="javascript:all(' 9 21:35:30','130766127')"><br> 9 21:35:30</a><a href="javascript:by_qid(' 9 21:35:30','130766127')">[130766127]</a> Rcpt 208.117.50.44 &lt;return@address.com&gt; &lt;myaccount@fake.co.nz&gt; 0  "" <a href="javascript:all(' 9 21:35:31','130766127')"> 9 21:35:31</a><a href="javascript:by_qid(' 9 21:35:31','130766127')">[130766127]</a> Received 208.117.50.44 return@address.com &lt;myaccount@fake.co.nz&gt; 120395 &lt;XJkzvvWDQXeUsz7INbIxGQ@ismtpd0003p1lon1.sendgrid.net&gt; "Relay=islocal, nrcpt=1, f="Booking.com" &lt;email.campaign@sg.booking.com&gt;, s=[Chris - Whakapapa Village and Adelaide! There's a deal with your name on it!]" <a href="javascript:all(' 9 21:35:32','130766127')"> 9 21:35:32</a><a href="javascript:by_qid(' 9 21:35:32','130766127')">[130766127]</a> Aspam 208.117.50.44 return@address.com &lt;myaccount@fake.co.nz&gt; 120395 &lt;XJkzvvWDQXeUsz7INbIxGQ@ismtpd0003p1lon1.sendgrid.net&gt; "notrust *****: 5.8 sd=5.8 l=0.00 nok=2/0 m=2 nf=0 Close 0.05(X-SpamContent:clean) 0.95(X-myrbl:Color=brown) 0.91(isclickimage2) 0.82(isclickimage1) 0.20(X-Phrase:clean) 0.37(dkimok) 0.37(genuine) 0.60(spfpass) 0.46(X-NotAscii:utf) 0.53(X-LangGuess:English) 0.49(X-Verify-Helo:+OK) SanScore 0.0 5.8 Sval 5.8"  9 21:35:32.00 [130766127] Spam 208.117.50.44 &lt;return@address.com&gt; &lt;myaccount@fake.co.nz&gt; 120395 &lt;XJkzvvWDQXeUsz7INbIxGQ@ismtpd0003p1lon1.sendgrid.net&gt; "[o4.sg.booking.com] SpamDetect"  9 21:35:32.00 [130766127] Stored 208.117.50.44 &lt;return@address.com&gt; &lt;myaccount@fake.co.nz&gt; 120395 &lt;XJkzvvWDQXeUsz7INbIxGQ@ismtpd0003p1lon1.sendgrid.net&gt; "[o4.sg.booking.com] Stored locally /home/surgemail/netwin.co.nz/hc/gf/chrisp/mdir/new/1470796532.2114_15646.netwin.netwinsite.co" Cpu time used      0 cpu seconds</pre>



<pre class="wp-block-preformatted">For an outgoing message it looks like this:<br><a href="javascript:all(' 9 21:39:48','130766226')"><br> 9 21:39:48</a><a href="javascript:by_qid(' 9 21:39:48','130766226')">[130766226]</a> Rcpt 115.188.8.177 &lt;myaccount@fake.co.nz&gt; &lt;user@destination.com&gt; 0  "" <a href="javascript:all(' 9 21:39:49','130766226')"> 9 21:39:49</a><a href="javascript:by_qid(' 9 21:39:49','130766226')">[130766226]</a> Received 115.188.8.177 myaccount@fake.co.nz &lt;user@destination.com&gt; 566 &lt;6a197213-738a-76f8-44d7-3e98ddb34224@netwin.co.nz&gt; "Relay=smtpauth=myaccount@fake.co.nz, nrcpt=1, s=[test]" <a href="javascript:all(' 9 21:39:49','130766226')"> 9 21:39:49</a><a href="javascript:by_qid(' 9 21:39:49','130766226')">[130766226]</a> NOSPAM 115.188.8.177 myaccount@fake.co.nz &lt;user@destination.com&gt; 566 &lt;6a197213-738a-76f8-44d7-3e98ddb34224@netwin.co.nz&gt; "trusted origin so skipping spam filtering g_smite_skip_relay"  9 21:39:53.00 [130766226] Sent 115.188.8.177 &lt;myaccount@fake.co.nz&gt; &lt;user@destination.com&gt; 566 &lt;6a197213-738a-76f8-44d7-3e98ddb34224@netwin.co.nz&gt; "[115-18-8-177.jetstream.xtra.co.nz] Delivered to remote host 12.9.234.50 used SSL - 250 message sent ok " </pre>



<p>In both cases the line you want when hunting a hacked account is the 'Received' entry, this shows you why the message was accepted by your server.</p>



<ul class="wp-block-list">
<li>smtpauth=user@xyz.com (The user gave valid smtp auth credentials, which are listed.)</li>



<li>g_relay_allow_ip (The sender is from a trusted ip address you have listed)</li>



<li>islocal (The message is to a local account/domain, or was being forwarded by one)<br></li>
</ul>



<p>To find this look for the Relay=... text in the line, e.g. in this example the message is relayed because the sender authenticated correctly as myaccount@fake.co.nz</p>



<pre class="wp-block-preformatted"><a href="javascript:all(' 9 21:39:49','130766226')"> 9 </a>21:39:49[130766226] Received 115.188.8.177 myaccount@fake.co.nz &lt;user@destination.com&gt; 566 
   &lt;6a197213-738a-76f8-44d7-3e98ddb34224@netwin.co.nz&gt; "<strong>Relay=smtpauth=myaccount@fake.co.nz</strong>, nrcpt=1, s=[test]"
</pre>



<p>The number in square brackets lets you find all related log entries, e.g. search on 130766226 in the above example</p>



<p>In some cases you will need to find events just before a log entry, to find what caused the message to be sent, to do this search on the date and time, e.g. "9 21:39:4" in the above example...

</p>



<h2 class="wp-block-heading">Settings to help auto detect spammers.</h2>



<p>One or more of your users will have their account hacked and abused to send spam sooner or later, you can make it much harder, and you can detect it and stop it early using these settings and policies.</p>



<pre class="wp-block-preformatted"># Login guesses per IP before it is automatically and permenently locked out.&nbsp;&nbsp; Use tellmail unlock ip.address to fix...
G_HACKER_MAX "10"&nbsp;&nbsp;&nbsp;

# If hacker attempts to login to one of these then the ip is instantly locked out.&nbsp; (Don't use accounts that exist)
G_HACKER_POISON "root@*,administrator@*"

# Only allow smtp logins if the user has previously logged in via imap/pop from the same address
G_SAFE_SMTP "true"

# Alert users when logins occur from unknown addresses that are not from australia or usa...
G_SAFE_WARNING "true"
g_safe_country "us,au"
&nbsp;
# Max messages an authenticated user can send per 30 minutes, e.g. 5000
G_SPAM_USER_MAX "2000"

# Max outgoing messages per ipaddress/return path pair, 30 minutes, e.g. 5000
G_SPAM_FROM_MAX "2000"

# Detect local users sending 'spam like' email and send a report to the manager.
G_OUTGOING_N "5"

# White list for people you know send mail that looks a bit dodgy.
G_OUTGOING_WHITE "bob@here.com,1.2.3.4"

# send manager an&nbsp; email if a local user sends more than 300 message in a day...
G_USER_SEND_WARNING "300"
g_user_send_ip "300"

# Apply some more strict password checking, and alert users with simple passwords...
G_CREATE_PASS_DIGIT "true"
G_CREATE_PASS_RECHECK "true"
G_HACK_TOUSER "true"</pre>



<h2 class="wp-block-heading">Settings to stop spoofing/forging of your domains.</h2>



<ol class="wp-block-list">
<li><a href="https://surgemail.com/knowledge-base/sending-email-to-avoid-spam-filters-best-practices/">Turn on SPF and DKIM and DMARC for all your domains.</a></li>



<li>Consider some of the below settings, some may cause false positives (blocking real email) so use with caution.</li>



<li>Use the config checker! </li>
</ol>



<pre class="wp-block-preformatted">g_dmarc_use "true"
g_dmarc_enforce "true"
g_spf_nofriend "true"
g_friends_obey_spf "true"&nbsp;
g_spf_enforce_local "true"
g_friends_obey_spf "true"
g_friends_local_match "true"
g_friends_spf "true"    # requires 7.3p-36 
g_from_stamp "true"    # stamp forgeries in the spam headers but don't actually stop them. 
                       # alternative is g_from_bounce setting (not recommended)
</pre>



<p><strong>Optional settings depending on your tolerance for bouncing real messages.</strong></p>



<pre id="block-44857855-5edb-489a-86ee-7957c65f8ff2" class="wp-block-preformatted">g_from_exact "true"&nbsp; # Bounce if the from doesn't match the authenticated sender
g_from_noforge "true"&nbsp;# Block some types of from forgery.
g_from_noforgeme "true" # checks for the special case of 'from=to' 
g_from_check "true"&nbsp; # enables some checking of the from address.
g_from_nofriend "true"  # prevent friend matches for apparently forged return addresses.  </pre>



<p></p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/find-and-stop-spammers-and-hackers/">Find and stop spammers and hackers</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Mfilter rule syntax</title>
		<link>https://surgemail.com/knowledge-base/mfilter-rule-syntax/</link>
		
		<dc:creator><![CDATA[chrisp]]></dc:creator>
		<pubDate>Sun, 17 Nov 2019 23:50:59 +0000</pubDate>
				<guid isPermaLink="false">https://surgemail.com/?post_type=ht_kb&#038;p=1236</guid>

					<description><![CDATA[<p>Fast processing of incoming messages. A simple, clear, syntax so that rules can easily be understood and modified Enough power/flexibility Incorporate regular expression matching to give real power. How to configure rules: Simply create a file called&#160;mfilter.rul&#160;in the&#160;SurgeMail home area&#160;(as defined in SurgeMails config) Use the test command via the SurgeMail admin interface to check<br /><a class="moretag" href="https://surgemail.com/knowledge-base/mfilter-rule-syntax/">+ Read More</a></p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/mfilter-rule-syntax/">Mfilter rule syntax</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<ul class="wp-block-list"><li>Fast processing of incoming messages.</li><li>A simple, clear, syntax so that rules can easily be understood and modified</li><li>Enough power/flexibility</li><li>Incorporate regular expression matching to give real power.</li></ul>



<h3 class="wp-block-heading">How to configure rules:</h3>



<ul class="wp-block-list"><li>Simply create a file called&nbsp;<strong>mfilter.rul</strong>&nbsp;in the&nbsp;<strong>SurgeMail home area</strong>&nbsp;(as defined in SurgeMails config)</li><li>Use the test command via the SurgeMail admin interface to check that your filter works as expected</li><li>Please note that "local.rul" should be used for adding scoring for ASPAM not mfilter.rul.</li></ul>



<h3 class="wp-block-heading">Tracing problems</h3>



<p>If you have problems getting mfilter to run you can use these two settings in surgemail.ini, they will provide logging to show exactly what is going on.</p>



<pre class="wp-block-preformatted">g_mfilter_trace "true"
g_mfilter_noisey "true"</pre>



<p>then examine 'mail.log' after sending in a test message.</p>



<h2 class="wp-block-heading">Syntax Of mfilter.rul File</h2>



<h3 class="wp-block-heading">There are 6 valid statements in a rule file:</h3>



<p>Assignment<br>Action<br>if (Conditional_Expression) [and (Conditional_Expression)...] Action<br>else<br>end if<br>call built_in_function()</p>



<h3 class="wp-block-heading">Assignment</h3>



<p>$variable_name = "quoted string" [+ "quoted string" [+ $variable ...]]<br>$variable_name = function()</p>



<h3 class="wp-block-heading">Action</h3>



<p>accept "reason" | bounce "reason" | drop "reason" | forward "user@domain" | then | setflag("flagname") | clearflag("flagname")</p>



<h3 class="wp-block-heading">Conditional Expression (if, else, end if)</h3>



<p>Any pre-defined function, e.g. isbinary()<br>isin("subject","free pictures")<br>Numeric comparisons, e.g. lines()&gt;100<br>Simple NOT operator, e.g. if (!isbinary()) reject "Only binaries allowed here mate!"<br>Calculations are NOT permitted, e.g. lines()+10 would fail</p>



<h3 class="wp-block-heading">Recipients block for processing individual recipients</h3>



<p>A single mail message may have many recipients, and in many cases the actions of your spam filter should vary depending on the recipients (you might, for example, want all messages to your account to get through even if the same message would be blocked if sent to any other user).</p>



<p>The recipient block (recipients...end recipients) is processed once for each recipient of the message.</p>



<p>Inside the 'recipients' block there is a dummy variable defined 'recipient' which is the specific recipient in question.</p>



<p>All the action's (except, bounce, drop) refer to the recipient only, not to the entire message, so when one of those actions that normally terminates message processing is encountered (accept, bounce, drop, etc) instead the action is applied only to that recipient and the recipient block is restarted with the next recipient defined.</p>



<p>(Example of mfilter rule to do processing 'per recipient')</p>



<pre class="wp-block-preformatted">recipients
       if (isin("recipient","manager@this.domain")) accept "Always accept for me        so spammers can talk to me"
       if (isin("recipient","sales@your.domain")) then
       	if (isin("subject","order")) then
       		# Make a Duplicate of sale order
       		call forward_cc(<a href="mailto:sales_copy@your.domain">"sales_copy@your.domain"</a>)
       	end if
       end if
end recipients </pre>



<h2 class="wp-block-heading">Miscellaneous</h2>



<h3 class="wp-block-heading">Line Continuation</h3>



<p>Lines can be continued by ending the line in a '\' character</p>



<h3 class="wp-block-heading">Quoting Strings</h3>



<p>All strings and header names should be within double quotes, sometimes you may get away without doing this, but we don't guarantee this will work in future. e.g. use: exists("Supersedes") not exists(Supersedes); quotes can be escaped in the usual way, e.g. "This \"Word\" has quotes around it"</p>



<h3 class="wp-block-heading">Assignments</h3>



<p>Assignments are processed at compile time, variables DO NOT exist at run time. Do not think of this as a programming language, but rather as a list of rules that are processed with each incoming message. Real run-time variables only exist in the form of the ifflag("xxx") function and the setflag("xxx") action.</p>



<p>For example, the following is NOT VALID, as the assignment is processed before the rules are run. The rejection would always read "big message"</p>



<pre class="wp-block-preformatted">$fred = "small message"
if (lines()&gt;100) then
&nbsp;&nbsp; $fred = "big message" (this will not work as expected)
end if
reject $fred</pre>



<h3 class="wp-block-heading">Odd stuff</h3>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>The statement '<strong>do_bounce_fast</strong>' should appear at the end of your mfilter.rul file, and it is used by the rexp_fast() rules.&nbsp;<strong>rexp_fast</strong>&nbsp;acts just like rexp() but it is much faster because it searches the message once for all of the rules in question, each rule must start with two simple non 'regular expression' characters. This enables mfilter to generate a hash table of all the regular expressions it's going to search for and then it can efficiently apply only the ones that appear to match as it runs through the message. Also rexp_fast includes the score to apply if the message matches the rule.</p></blockquote>



<h2 class="wp-block-heading">Actions &amp; Commands</h2>



<h3 class="wp-block-heading">Actions</h3>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><a href="https://netwinsite.com/surgemail/help/mfilter.htm#accept">accept</a>"reason" (Terminates processing)<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#bounce">bounce</a>&nbsp;"reason" (Terminates processing)<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#reject">reject</a>&nbsp;"reason" (same as bounce)<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#forward">forward</a>&nbsp;"reason" (Terminates processing) (redirect is a synonym for this action)<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#print">print</a>&nbsp;"reason" (Prints debugging line to log file mail.log)<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#setflag">setflag("flagname")</a>&nbsp;"reason"<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#clearflag">clearflag("flagname")</a>&nbsp;"reason"</p><p>Functions that have actions but must be proceeded by the 'call' action as they are really functions and must be on a line of their own (not on the end of an if statement)</p><p>call&nbsp;<a href="https://netwinsite.com/surgemail/help/mfilter.htm#forwardcc">forward_cc</a>("new@email.address)<br>call&nbsp;<a href="https://netwinsite.com/surgemail/help/mfilter.htm#replace">replace</a>("header_name","wildcard_match_pattern","replacement_pattern")<br>call&nbsp;<a href="https://netwinsite.com/surgemail/help/mfilter.htm#report">report</a>("manger@email.address","subject of message")</p></blockquote>



<h3 class="wp-block-heading">Builtin Functions</h3>



<p><a href="https://netwinsite.com/surgemail/help/mfilter.htm#add_header">call add_header</a>("Header: header information")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#allmod">allmod</a>()<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#exists">exists</a>("header")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#head_len">head_len</a>("header")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#isbase64">isbase64</a>()<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#isbinary">isbinary</a>() )<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#isencodedhtml">isencodedhtml</a>()<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#isencodedtext">(isencodedtext</a>()<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#isencodedurl">isencodedurl</a>()<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#isflag">isflag</a>("flag-name")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#ishtml">ishtml</a>()<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#isimage">isimage</a>()<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#isin">isin</a>("header","string-not-case-sensitive")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#lines">lines</a>()&gt;3)<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#match">match</a>("header","wildcard")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#matchall">matchall</a>("header","wildcardlist")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#matchone">matchone</a>("header","wildcardlist")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#rexp">rexp</a>("header","regular-expression")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#size">size</a>()<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#spamdetect">call spamdetect</a>(n,"reason")<br><a href="https://netwinsite.com/surgemail/help/mfilter.htm#spawn">call spawn</a>("d:/surge/filter.exe $FILE$")</p>



<p>New Functions</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>time_hour() - returns the 'hours' 0-23, useful for rules that apply at different times of day<br>time_min() - returns the minutes<br>isimage() - True if message contains an image<br>isjpg() - True if message contains a jpeg image<br>ispdf() - True if message contains a pdf file<br>image_size() - Approx size of image in bytes<br>nimage() - Approx number of images found in message<br>islocal() - Message is to a local user not an outgoing message<br>isloggedin() - Message is from a logged in local user<br>is_dayofweek("monday,tuesday") - True on those days of the week.<br></p></blockquote>



<h3 class="wp-block-heading">Notes</h3>



<p>The "header" parameter can be any normal header, such as "Subject", "From" or "To". However, the are some additional pseudo-headers than can also be used as parameters in any function which takes a "header" parameter:</p>



<p>"head": refers to the entire message header.<br>"body": refers only to the message body (after any necessary decoding)<br>"urls": refers to any urls found in the body<br></p>



<h2 class="wp-block-heading">Function Descriptions</h2>



<h3 class="wp-block-heading">call add_header("Header: header information")</h3>



<p>Used to add a header to a message. eg</p>



<pre class="wp-block-preformatted">if (isin("x-spamdetect","****") then
call add_header("X-MailScanner-SpamCheck: LEVEL=****")
end if </pre>



<h4 class="wp-block-heading">NOTE: This will cause bounces if used in local.rul or simple.rul, it can only be used in mftiler.rul</h4>



<p>Requires Version 3.8 or later.</p>



<h3 class="wp-block-heading">allmod("header")</h3>



<p>This returns true if all the newsgroups in the specified header are moderated.</p>



<h3 class="wp-block-heading">exists("header")</h3>



<p>This is true if the header exists in the message and is non zero in length, eg: if (exists("supersedes")) then reject "We don't like supersedes headers"</p>



<h3 class="wp-block-heading">head_len("header")</h3>



<p>Returns the length of the named header, e.g.</p>



<pre class="wp-block-preformatted">if (head_len("date")&gt;60) bounce "Naughty message"</pre>



<h3 class="wp-block-heading">isbase64()</h3>



<p>This is true if the message appears to contain base64 binary encoded data.</p>



<h3 class="wp-block-heading">isbinary()</h3>



<p>This is true if the message has binary data either base64 encoding or uuencoded data.</p>



<h3 class="wp-block-heading">isencodedhtml()</h3>



<p>This is true if the message appears to contain MIME or uuencoded HTML instead of plain text data.</p>



<h3 class="wp-block-heading">isencodedtext()</h3>



<p>This is true if the message appears to contain MIME or uuencoded text data.&nbsp; This will always be true if isencodedhtml() returns true.</p>



<h3 class="wp-block-heading">isencodedurl()</h3>



<p>This is true if the message appears to contain an uuencoded URL reference.</p>



<h3 class="wp-block-heading">isflag("flag-name")</h3>



<p>Used to check whether a flag variable has been defined as true. This can be done with the setflag("flag-name") action, e.g.</p>



<pre class="wp-block-preformatted">if (size()&gt;100000) setflag("bigitem")
if (isimage()) setflag("bigitem")
if (isflag("bigitem")) reject "It was a big item or had a picture in it"</pre>



<h3 class="wp-block-heading">ishtml()</h3>



<p>This is true if the message appears to contain HTML instead of plain text data.</p>



<h3 class="wp-block-heading">isimage()</h3>



<p>This is true if the message appears to contain a picture (either MIME or uuencoded)</p>



<h3 class="wp-block-heading">isin("header","string-not-case-sensitive")</h3>



<p>This is a simple 'content' searching function if the named header contains the string (a non case sensitive match is used) eg:</p>



<pre class="wp-block-preformatted">if (isin("Subject","Free"))
reject "Probably a spammer selling something"</pre>



<p>This would reject a message containing a subject of "Get your Free pictures here" it would also reject a message containing a subject of "Is there any real freedom in the world?" so it's probably not a good rule <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<h3 class="wp-block-heading">lines()</h3>



<p>This returns the number of lines in the message.</p>



<h3 class="wp-block-heading">match("header","wildcard")</h3>



<p>This function applies a simple wild card matching algorithm as is typically used to match file names, eg:</p>



<pre class="wp-block-preformatted">match("From","*@netwin.co.nz*")</pre>



<p>would match against a message from that domain.</p>



<h3 class="wp-block-heading">matchall("header","wildcardlist")</h3>



<p>Used for matching a single wild card&nbsp;against a header which contains a list of values, like Newsgroups:, Path: etc..., The match is TRUE only if all entries in the list match, eg:</p>



<pre class="wp-block-preformatted">if (matchall("Newsgroups","news.filters.*")) accept "It is only in the filters list so we will accept it"</pre>



<h3 class="wp-block-heading">matchone("header","wildcardlist")</h3>



<p>Identical to the above function but returns 'TRUE' if any match occurs.</p>



<h3 class="wp-block-heading">rexp("header","regular-expression")&nbsp;This function searches the named header for a regular expression, the matching is not case sensitive, use rexp_case() for a case sensitive version.</h3>



<h3 class="wp-block-heading">rexp_fast(spamdetect_score,"regular expression ","comment for spam header")</h3>



<p>This is just like rexp, but it does the search more efficiently, the first 2 characters of regular expression must be plain ascii (not a regular expression) if it's found in the body of the message then the score is added to the spam_detect header</p>



<h3 class="wp-block-heading">size()</h3>



<p>Returns the size in bytes of the current message can be used with &gt; and &lt; operators.</p>



<h3 class="wp-block-heading">call spamdetect(n,"reason")</h3>



<p>This function can be used to mark a message as possible spam, the 'n' is a (floating-point) number and each time this function is called for a message the total is increased, then finally a header is added to the message;</p>



<p>X-SpamDetect: &lt;stars&gt;: &lt;score&gt; &lt;reason1&gt; [reason2 [reason3 ... ]]<br><br>&lt;stars&gt; is a string of n stars, where n is the total score (capped at 20)<br>&lt;score&gt; is the total spam score<br></p>



<p>The idea is that users can then set their mail clients to filter messages based on this pseudo header. For instance, filtering any message with "******" in its X-SpamDetect header will throw out any message with a score of 6 or more.</p>



<p>Please note that "local.rul" should be used for adding scoring for ASPAM not mfilter.rul.</p>



<h3 class="wp-block-heading">call spawn("program.exe $FILE$")</h3>



<p>This function runs a program on each message the $FILE$ macro is replaced by a temporary file name containing the actual mail message. The return value of the program (return n; in main() function) is returned by this 'spawn' function, so it can be used to filter the message or allow it to continue. eg:</p>



<pre class="wp-block-preformatted">if (spawn("d:/path/xfilter.exe $FILE$")) reject "That was spam according to xfilter" </pre>



<p><strong>NOTE: The mfilter is only passed the first 14k of each message, and so the spawned program also only gets the first 14k not the entire message.</strong></p>



<h2 class="wp-block-heading">Actions</h2>



<h3 class="wp-block-heading">accept "reason"</h3>



<p>Accepts the current article reporting the "reason" specified in the log files.</p>



<h3 class="wp-block-heading">clearflag("flag-name")</h3>



<p>Used to set the specified flag variable to the false state.</p>



<h3 class="wp-block-heading">forward "remote@address.com"</h3>



<p>Forwards the message to the specified address and terminates processing.</p>



<h3 class="wp-block-heading">call forward_cc("new@email.address")</h3>



<p>Sends the current message to this new Email address in addition to any existing destination users.</p>



<h3 class="wp-block-heading">reject "reason" (or bounce "reason")</h3>



<p>Rejects the current article reporting the "reason" specified in the log files and to the user</p>



<h3 class="wp-block-heading">call replace("header_name","wildcard_match_pattern","replacement_pattern")</h3>



<p>If the named header matches the 'wildcard_match_pattern' then the replacement pattern is applied, e.g.</p>



<p>replace("from","*@*.domain.name","BOB_%1@%2.other.name")Subject: "joe@this.domain.name"Would be translated to:Subject: "BOB_joe@this.other.name"</p>



<h3 class="wp-block-heading">call report("manger@email.address","subject of message")</h3>



<p>Sends an Email, including the top part of the offending message, to the specified person, with the specified subject. This is intended when you want to be alerted to something but don't want to simply forward the message itself which may be 'confusing' as it would look like the message had been sent to the manager directly.</p>



<h3 class="wp-block-heading">setflag("flag-name")</h3>



<p>Used to set the specified flag variable to the true state.<br></p>



<h2 class="wp-block-heading">Regular Expression Syntax - In Brief</h2>



<p>Please note you need to escape spaces in this implementation.<br>eg:</p>



<p>sweepstake lottery / international program<br>sweepstake lottery/ international program<br>sweepstake lottery /international program</p>



<p>So what you want is this. Just put slashes in front of the spaces.</p>



<p>sweepstake lottery( / | /|/ )international program</p>



<p>if (rexp("subject","sweepstake lottery(\ /\ |\ /|/\ )international program")) bounce "a"</p>



<p><br><strong>\s</strong>&nbsp;= white space<br><strong>\S</strong>&nbsp;= not white space<br><strong>\d</strong>&nbsp;= digit<br><strong>\D</strong>&nbsp;= not digit<br><strong>\b</strong>&nbsp;= word boundary<br><strong>\B</strong>&nbsp;= not word boundary<br><strong>\x00</strong>&nbsp;= Hex character</p>



<p><strong>.</strong>&nbsp;(period) represents any one character.<br><strong>[]</strong>&nbsp;(brackets) contain a set of characters from which a match can be made. It corresponds to one character in the search string.<br><strong>\</strong>&nbsp;(backslash) is an escape character which means that the next character will not have a special meaning.<br><strong>*</strong>&nbsp;(asterisk) is a multiplier. It will match zero or more of the previous character. (Note: it is not a wildcard character as in file names.)<br><strong>?</strong>&nbsp;(question mark) is a multiplier. It will match zero or one of the previous character. (Note: it is not a wildcard character as in file names.)<br><strong>+</strong>&nbsp;(plus) is a multiplier. It will match one or more of the previous character.<br><strong>{}</strong>&nbsp;(squiggly brackets) contain a number which specifies an exact number of the previous character, or range {2,3}<br><strong>[^]</strong>&nbsp;(brackets containing caret and other characters) means any characters except the character(s) after the caret symbol<br>in the brackets.<br><strong>^</strong>&nbsp;(caret) is the start of the line.<br><strong>$</strong>&nbsp;(dollar) is the end of the line.<br><strong>(Note the following \&lt; \&gt; (begin and end word) are not implemented, use \b instead)</strong></p>



<p><strong>[:alpha:]</strong>&nbsp;represents any alphabetic letter.<br><strong>[:digit:]</strong>&nbsp;represents any single-digit number.<br><strong>[:blank:]</strong>&nbsp;represents a space or tab.</p>



<p><strong>Lookahead operator</strong><br>Free(?!dom|bsd) matches freesex but not freedom or FreeBSD</p>



<p><strong>OR operator</strong><br>| (pipe) is OR. It requires that the joined expressions have parentheses around them.</p>



<h4 class="wp-block-heading">Examples:</h4>



<p>e.a matches eta, eda, e1a, but not Eta<br>[eE].a matches eta and Eta<br>E.*a matches Eudora, Etcetera, Ea<br>ho+p matches hop, hoop, hoooop, but not hp<br>etc\. matches etc. but not etc<br></p>



<h2 class="wp-block-heading">Example rule file:</h2>



<pre class="wp-block-preformatted">$sex = "fuck|xxx|sex"
$free = "free(?!dom|bsd|nix|serve)"
$pics = "pi[cx]"
$free_pictures = $free + $pics
$bad_guys = + "|freepictures|jus.?.?\.doi.?.?\.to|great\.site|webbinaries" \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + "|yad.?.?.?\.ion.?.?\.org|freehidden|joy.?.?\.to.?.?\.al|from.?behind" \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + "|love(youhon|ergirl|chatting|stofuck)|forever\.yours|\@ju.?.?\.sex|town.\girl|beachbums" \i</pre>



<pre class="wp-block-preformatted"># Do some processing which is specific to individual recipients
recipients
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (isin("recipient","manager@this.domain")) accept "Always accept for me so spammers can talk to me"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (isin("recipient","sales@your.domain")) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (isin("subject","order")) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Make a Duplicate of sale order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call forward_cc(<a href="mailto:sales_copy@your.domain">"sales_copy@your.domain"</a>)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if
end recipients</pre>



<pre class="wp-block-preformatted"># Check for some known spammers and naughty subjects
if (rexp(subject,$free_pictures)) bounce "No emails about free pictures"
if (rexp(from,$bad_guys)) bounce "No emails from black listed people thanks"

# Strip local node names from from addresses:
call replace("From","*@*.parts.co.nz",<a href="mailto:$1@parts.co.nz">"%1@parts.co.nz"</a>)</pre>



<pre class="wp-block-preformatted">accept "Great, we liked the message"

</pre>



<h3 class="wp-block-heading">Example 2:</h3>



<p>We want to block any message that has been found in SURBL database. We will use the exists function to check if that header exists.</p>



<pre class="wp-block-preformatted">if (exists("X-Surbl")) reject "Your SPAM is not wanted here."</pre>



<p>You can easily change that to drop the message silently if you prefer<br></p>



<pre class="wp-block-preformatted">if (exists("X-Surbl")) drop "SURBL SPAM is not wanted here." </pre>



<p>(The reason will be logged so still important to put there)</p>



<h3 class="wp-block-heading">Example 3:</h3>



<p>We want to block any message with no subject header. SurgeMail adds a subject header if it is missing so we have to match on the text that SurgeMail adds.<br></p>



<pre class="wp-block-preformatted">if (isin("Subject","(No subject header)")) bounce "No Subject header"</pre>



<h3 class="wp-block-heading">Example 4:</h3>



<p>We want to block any message with an empty subject header.<br></p>



<pre class="wp-block-preformatted">if (head_len("Subject")&lt;1) bounce "Emtpy Subject header"</pre>



<h3 class="wp-block-heading">Example 5:</h3>



<p>I have a user fred in one of my local domains localdomain.com I only want him to be able to send to other users at localdomain.com and not to any other domains.</p>



<pre class="wp-block-preformatted">recipients
if (isin("from","fred@localdomain.com")) then
     if (!isin("recipient", "localdomain.com")) bounce "Sorry you can only send to localdomain.com"
end if </pre>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/mfilter-rule-syntax/">Mfilter rule syntax</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Enable Spam handling</title>
		<link>https://surgemail.com/knowledge-base/enable-spam-handling/</link>
		
		<dc:creator><![CDATA[chrisp]]></dc:creator>
		<pubDate>Wed, 06 Nov 2019 03:26:08 +0000</pubDate>
				<guid isPermaLink="false">http://surgemail.com/?post_type=ht_kb&#038;p=799</guid>

					<description><![CDATA[<p>Upgrade to the latest stable release Press the 'config checker' button in the web admin interface and turn on the settings it suggests Either set G_FRIENDS_DEFAULT_MODE "smite" Tell all users to individually turn on/set/adjust their friends options in the user self admin settings. For general purpose email systems, set the default to block at&#160;g_friends_spam_score '10'<br /><a class="moretag" href="https://surgemail.com/knowledge-base/enable-spam-handling/">+ Read More</a></p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/enable-spam-handling/">Enable Spam handling</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<ol class="wp-block-list"><li>Upgrade to the latest stable release</li><li>Press the 'config checker' button in the web admin interface and turn on the settings it suggests</li><li>Either set G_FRIENDS_DEFAULT_MODE "smite" </li><li>Tell all users to individually turn on/set/adjust their friends options in the user self admin settings.</li><li>For general purpose email systems, set the default to block at&nbsp;<strong>g_friends_spam_score '10'</strong></li></ol>



<h2 class="wp-block-heading">How users can report/train spam</h2>



<ol class="wp-block-list"><li>IMap users can drop spam messages into the 'Spam' folder</li><li>SurgeWeb users can click on 'Is Spam'</li></ol>



<h2 class="wp-block-heading">How it works</h2>



<p>Spam is scored based on many things (source ip address, content, history of that sender etc). Once a score is arrived at the users preferences are consulted, if the score is above the users setting then the message goes into the Spam folder, and the sender is informed so they can request delivery (if they are a human).  </p>



<p>We recommend a system default of 10 to give reasonable results for general purpose email systems. </p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/enable-spam-handling/">Enable Spam handling</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Global Settings g_friends</title>
		<link>https://surgemail.com/knowledge-base/global-settings-g_friends/</link>
		
		<dc:creator><![CDATA[chrisp]]></dc:creator>
		<pubDate>Wed, 06 Nov 2019 00:12:25 +0000</pubDate>
				<guid isPermaLink="false">http://surgemail.com/?post_type=ht_kb&#038;p=714</guid>

					<description><![CDATA[<p>g_friends_add_trusted - Add to friends list when if sender is trusted This is useful if senders are not using smtp auth but you still want friends to be added, typically used with surgewall... Syntax: g_friends_add_trusted bool g_friends_allow_spf - Allow all email through as if it was a friend during temporary allow The user click on<br /><a class="moretag" href="https://surgemail.com/knowledge-base/global-settings-g_friends/">+ Read More</a></p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/global-settings-g_friends/">Global Settings g_friends</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">g_friends_add_trusted - Add to friends list when if sender is trusted</h3>



<p>This is useful if senders are not using smtp auth but you still want friends to be added, typically used with surgewall...</p>



<p>Syntax: g_friends_add_trusted bool</p>



<h3 class="wp-block-heading">g_friends_allow_spf - Allow all email through as if it was a friend during temporary allow</h3>



<p>The user click on a button to disable friends for a few hours, during this time all messages will get treated as a friend and thus bypass SPF too.</p>



<p>Syntax: g_friends_allow_spf bool</p>



<h3 class="wp-block-heading">g_friends_always - Always use friends list.</h3>



<p>This enables the "Add all outgoing email addresses to list" feature and always checks incoming messages against the friends list so that SurgeMail can correctly tag or filter it.</p>



<p>Syntax: g_friends_always bool</p>



<h3 class="wp-block-heading">g_friends_at_rcpt - Whether to check users friends list at rcpt stage</h3>



<p>This setting is automatically added/removed by the web admin when global friends defaults are configured. It allows us to check friends at rcpt stage without paying a disk access cost for non-friends users.</p>



<p>Syntax: g_friends_at_rcpt bool</p>



<h3 class="wp-block-heading">g_friends_autodom - Auto whitelist friends based on domain/ip</h3>



<p>This means a friend or trained message will whitelist the entire domain/ip address combination until contradicted for all users</p>



<p>Syntax: g_friends_autodom bool</p>



<h3 class="wp-block-heading">g_friends_bounce_friend - Allow exception rules to bounce a mesesage from a friend</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_bounce_friend bool</p>



<h3 class="wp-block-heading">g_friends_bounce_rej - Reject blank return path as friends failures</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_bounce_rej bool</p>



<h3 class="wp-block-heading">g_friends_bounce_second - Bounce the next time the user sends a message if waiting for confirm still</h3>



<p>This can make it clearer that email is not getting through to the destination</p>



<p>Syntax: g_friends_bounce_second bool</p>



<h3 class="wp-block-heading">g_friends_byemail - Use old email based friends rejections</h3>



<p>This restores the old beahviour, you would normally only use this if your mail server was unaccessable via http as email based rejections are not as easy to use or as reliable as web based human confirmations</p>



<p>Syntax: g_friends_byemail bool</p>



<h3 class="wp-block-heading">g_friends_check_spf - Disable friends bounces if SPF headers missing/failed to avoid backscatter.</h3>



<p>If the incoming message may be forged it will bounce messages using an smtp error code to deny delivery but it will allow any real sender to bypass this. This settings is good if spamcop block your domain for sending friends challenges as it cuts down on the number of such messages. This avoids backscatter</p>



<p>Syntax: g_friends_check_spf bool</p>



<h3 class="wp-block-heading">g_friends_cleanup - Cleanup/repair large friend.lst files</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_cleanup bool</p>



<h3 class="wp-block-heading">g_friends_confirm_debug - Log sucessful friends confirmation responses</h3>



<p>This enables us to examine suspect replies to friends confirmations for indications that they were sent by spammers or mail robots.</p>



<p>Syntax: g_friends_confirm_debug bool</p>



<h3 class="wp-block-heading">g_friends_confirm_subject - String to use as the subject of a friends confirmation email</h3>



<p>String to use as the subject of a friends confirmation email. Defaults to:&nbsp;<em>"Please reply to ||confirm|| message and allow delivery"</em>. This value&nbsp;<strong>must&nbsp;</strong>contain the text ||confirm||, this text is replaced by the unique message id that allows SurgeMail to find the message to release eg. confirm(1150419513.1880_1180.domain). It is also advisable to place the ||confirm|| near the start of the string as some clients will truncate long subjects and any truncation of the ||confirm|| value will result in failure to release the message.</p>



<p>Syntax: g_friends_confirm_subject string</p>



<h3 class="wp-block-heading">g_friends_daemon_ok - Accept emails from any mailer deamon</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_daemon_ok bool</p>



<h3 class="wp-block-heading">g_friends_debug1 - NEVER USE, only for NetWin testing</h3>



<p>This makes surgemail always send an email bounce rather than a safe reject, only intended for testing bounce messages</p>



<p>Syntax: g_friends_debug1 bool</p>



<h3 class="wp-block-heading">g_friends_default_autoadd - Default auto addition when sending (recommended)</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_default_autoadd bool</p>



<h3 class="wp-block-heading">g_friends_default_mode - Default friends mode, smite (recommended) silent, or list</h3>



<p>Valid settings are kids,disabled,smite,silent,list. Recommended silent or smite, in silent mode no challenge email is sent, in smite mode a challenge email is sent if the score is exceeded.</p>



<p>Syntax: g_friends_default_mode string</p>



<h3 class="wp-block-heading">g_friends_global_add - Add to a global friends list if ip matches and sender doesn't match authenticated user</h3>



<p>Used when you wish to whitelist outgoing addresses even though the sender/reply address does not match the authenticated user (e.g. messages sent via exchange)</p>



<p>Syntax: g_friends_global_add string</p>



<h3 class="wp-block-heading">g_friends_global_exclude - Addresses not to auto add, e.g. *@paypal.com</h3>



<p>This is good for avoiding meaningless entries or obvious entries that people might send email to by mistake</p>



<p>Syntax: g_friends_global_exclude string</p>



<h3 class="wp-block-heading">g_friends_ignore - List of addresses considered friends for all users on the system</h3>



<p>List of addresses considered friends for all users on the system eg: the system manager email address</p>



<p>Syntax: g_friends_ignore string</p>



<h3 class="wp-block-heading">g_friends_ignore_trusted - If from trusted ip still apply friends</h3>



<p>Useful when you have a gateway that is sending to surgemail</p>



<p>Syntax: g_friends_ignore_trusted bool</p>



<h3 class="wp-block-heading">g_friends_lang_auto - Set users language settings automatically based on observed emails from friends</h3>



<p>This setting improves spam handling</p>



<p>Syntax: g_friends_lang_auto bool</p>



<h3 class="wp-block-heading">g_friends_latest_headers - Friends system re-read message headers</h3>



<p>Causes friends to re-read message headers, allowing rules based on headers added during delivery</p>



<p>Syntax: g_friends_latest_headers bool</p>



<h3 class="wp-block-heading">g_friends_local_match - If from!=returnpath and one is local, then block friends match</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_local_match bool</p>



<h3 class="wp-block-heading">g_friends_long - In friends web release addresses use a longer url</h3>



<p>Uses an older style link</p>



<p>Syntax: g_friends_long bool</p>



<h3 class="wp-block-heading">g_friends_msg - Message used for friends bounce.</h3>



<p>e.g. Delivery pending, to deliver you must send an email to</p>



<p>Syntax: g_friends_msg string</p>



<h3 class="wp-block-heading">g_friends_msg_link - Message used for friends link bounce.</h3>



<p>e.g. Note: Delivery will ONLY occur if you click on this link</p>



<p>Syntax: g_friends_msg_link string</p>



<h3 class="wp-block-heading">g_friends_name - What to call the friends system</h3>



<p>This specifies what to call the friends system when referring to it on web pages and in email to our users, you can call it whatever you like</p>



<p>Syntax: g_friends_name string</p>



<h3 class="wp-block-heading">g_friends_obey_spf - If SPF failed then no friends match allowed for local domains</h3>



<p>If spf failed then don't allow a friends match</p>



<p>Syntax: g_friends_obey_spf bool</p>



<h3 class="wp-block-heading">g_friends_old_status_email - Use older status email &amp; processing</h3>



<p>Use status.eml instead of status_html.eml</p>



<p>Syntax: g_friends_old_status_email bool</p>



<h3 class="wp-block-heading">g_friends_only - Friends system</h3>



<p>An anti-spam feature which screens incoming mail to ensure it comes from a human. For incoming mail from unknown addresses a message is sent to this person requesting them to reply to confirm they are human and the original message will be delivered.&nbsp;<a href="friends.htm">See this page for more details.</a></p>



<p>Syntax: g_friends_only bool</p>



<h3 class="wp-block-heading">g_friends_pending_keep - Time to keep friend pending messages</h3>



<p>How long to store users friends pending messages before deleting them (days)</p>



<p>Syntax: g_friends_pending_keep int</p>



<h3 class="wp-block-heading">g_friends_pending_max - Max items in pending before deleting them</h3>



<p>The default is 10000 Items</p>



<p>Syntax: g_friends_pending_max int</p>



<h3 class="wp-block-heading">g_friends_pending_name - The imap name of the friends_pending (and spam store) quarantine folder - should match surgeweb imap_spam_folder - default is 'Friends Pending'</h3>



<p>This shouldn't be changed unless this feature has not been used before as it will confuse your users. Any matching folder the user has of the same name will become invisible. So at least make it something other than simply Spam!!</p>



<p>Syntax: g_friends_pending_name string</p>



<h3 class="wp-block-heading">g_friends_pending_vanish - Enable auto-vanish of pending messages on confirmation bounce</h3>



<p>When a bounce for a confirmation message is received we vanish it, this setting will also delete the original message.</p>



<p>Syntax: g_friends_pending_vanish bool</p>



<h3 class="wp-block-heading">g_friends_release_wash - Clean any subject marking (ie stars) when releasing/allowing</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_release_wash bool</p>



<h3 class="wp-block-heading">g_friends_rotate - Rotate user level log file, default 30k</h3>



<p>Set log size, the log is also rotated when a friends report email is sent (if configured)</p>



<p>Syntax: g_friends_rotate int</p>



<h3 class="wp-block-heading">g_friends_safer - Make friends always avoid back scatter.</h3>



<p>By using a rejection during the incoming message instead of sending an email back scatter is completely avoided.</p>



<p>Syntax: g_friends_safer bool</p>



<h3 class="wp-block-heading">g_friends_silent - Disable friends responses to users</h3>



<p>This setting is to simply disable the confirm emails, not generally recommended as this makes friends a bit pointless.</p>



<p>Syntax: g_friends_silent bool</p>



<h3 class="wp-block-heading">g_friends_silent_level - If spam score above this then don't send friends message</h3>



<p>Not generally recommended.</p>



<p>Syntax: g_friends_silent_level int</p>



<h3 class="wp-block-heading">g_friends_skip_ip - List of ip addresses considered friends for all users on the system</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_skip_ip string</p>



<h3 class="wp-block-heading">g_friends_spam_score - Default level to quaranteen message in spam folder (Recommended 8 or 10)</h3>



<p>This sets the default when no friends.ini file exists, a level of 8 will give best all round results, a level of 10 will stop less spam but avoid false positives.</p>



<p>Syntax: g_friends_spam_score int</p>



<h3 class="wp-block-heading">g_friends_spf - Refine friends matching using spf/dmarc when possible</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_spf bool</p>



<h3 class="wp-block-heading">g_friends_spf_fail_bounce - Bounce SPF failures, do not send friends confirmations (Not recommended)</h3>



<p>The default behaviour is to only send confirmations if SPF checks pass, if they fail friends checking is skipped, no confirmation request is sent and the email is not blocked by friends.</p>



<p>Syntax: g_friends_spf_fail_bounce bool</p>



<h3 class="wp-block-heading">g_friends_status_sort - Sort friends status messages with low scores at the top</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_friends_status_sort bool</p>



<h3 class="wp-block-heading">g_friends_testurl - Test g_friends_url and status_url and url_host work externally</h3>



<p>Reports to manager if any fail</p>



<p>Syntax: g_friends_testurl bool</p>



<h3 class="wp-block-heading">g_friends_url - Specify default global url for friends release http://domain.name:port</h3>



<p>Normally the default will work.</p>



<p>Syntax: g_friends_url string</p>



<h3 class="wp-block-heading">g_friends_warnonce - Give bounce on only the first message</h3>



<p>This used to be the default, but it meant people thought delivery was occurring!</p>



<p>Syntax: g_friends_warnonce bool</p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/global-settings-g_friends/">Global Settings g_friends</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Global Settings g_from</title>
		<link>https://surgemail.com/knowledge-base/global-settings-g_from/</link>
		
		<dc:creator><![CDATA[chrisp]]></dc:creator>
		<pubDate>Wed, 06 Nov 2019 00:11:28 +0000</pubDate>
				<guid isPermaLink="false">http://surgemail.com/?post_type=ht_kb&#038;p=712</guid>

					<description><![CDATA[<p>g_from_allow_ip - IP addresses to bypass local from check This setting has no further documentation currently available Syntax: g_from_allow_ip string g_from_allow_to - destination user to bypass local from check This setting has no further documentation currently available Syntax: g_from_allow_to string g_from_bl - Domain Based Blacklist Zones, lookups FROM domain in dns The 'from' domain is<br /><a class="moretag" href="https://surgemail.com/knowledge-base/global-settings-g_from/">+ Read More</a></p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/global-settings-g_from/">Global Settings g_from</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">g_from_allow_ip - IP addresses to bypass local from check</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_from_allow_ip string</p>



<h3 class="wp-block-heading">g_from_allow_to - destination user to bypass local from check</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_from_allow_to string</p>



<h3 class="wp-block-heading">g_from_bl - Domain Based Blacklist Zones, lookups FROM domain in dns</h3>



<p>The 'from' domain is checked against the specified RBL which must be a special 'FROM' based rbl which lists spammers by from address. Most spammers fake from addresses so this is a fairly marginally useful method.</p>



<p>Syntax: g_from_bl name=string stamp=string</p>



<h3 class="wp-block-heading">g_from_body_bounce - Reject if local from header address is probably faked</h3>



<p>Checks if the sender is authenticated or from an address that can relay, if not then the message is bounced if it claims to be from a local domain. One of the settings to prevent forgery</p>



<p>Syntax: g_from_body_bounce bool</p>



<h3 class="wp-block-heading">g_from_bounce - Bounce if from is probably faked</h3>



<p>Bounce if from address is probably faked.</p>



<p>This check is activated for any mail with a local domain in the from address but not using SMTP authentcation, relay allow IP address or spam allow IP address.</p>



<p>Syntax: g_from_bounce bool</p>



<h3 class="wp-block-heading">g_from_check - Check from matches valid local domain</h3>



<p>Check from domains match valid local domains if user is authenticated, or g_from_allow.Should be used with g_from_bounce "true" which basically forces them to authenticate and then makes this setting work properly.</p>



<p>Syntax: g_from_check bool</p>



<h3 class="wp-block-heading">g_from_domain - Default domain for from envelope</h3>



<p>Fixes the 'from' envelope if the email client failed to specify a domain name, this doesn't fix the from header currently but we may change that in future!</p>



<p>Syntax: g_from_domain string</p>



<h3 class="wp-block-heading">g_from_exact - Check from matches authenticated user</h3>



<p>Check from matches authenticated user. If user is not authenticated the setting is skipped.</p>



<p>Should be used with g_from_bounce "true" which basically forces them to authenticate and then makes this setting work properly.<br></p>



<p>Syntax: g_from_exact bool</p>



<h3 class="wp-block-heading">g_from_force - From address for all sent messages</h3>



<p>Used when you want to make all messages use the same valid bounce address, reply-to header will contain original from if it doesn't exist</p>



<p>Syntax: g_from_force string</p>



<h3 class="wp-block-heading">g_from_header - From header used in delivery bounces</h3>



<p>From header used in delivery bounces.</p>



<p>Syntax: g_from_header string</p>



<h3 class="wp-block-heading">g_from_list_too - Also enforce from rules from lists</h3>



<p>Doesn't allow lists to bypass forge rules</p>



<p>Syntax: g_from_list_too bool</p>



<h3 class="wp-block-heading">g_from_must_exist - Require local from addresses to exist or reject mail</h3>



<p>Can be useful in blocking dumb spam robots</p>



<p>Syntax: g_from_must_exist bool</p>



<h3 class="wp-block-heading">g_from_noforge - If envelope or from is local domain then the other must be too</h3>



<p>This can prevent many common forms of forgery, this will bounce some real email, so probably better to use the noforgeme setting instead. One of the settings to prevent forgery</p>



<p>Syntax: g_from_noforge bool</p>



<h3 class="wp-block-heading">g_from_noforge_some - If from matches this then from/envelope must match</h3>



<p>Prevent forgeries of important local addresses, e.g. *support*</p>



<p>Syntax: g_from_noforge_some string</p>



<h3 class="wp-block-heading">g_from_noforgeme - If to==from then from and env from must match</h3>



<p>This can prevent many common forms of forgery, this is safer than the noforge setting above, and generally almost as effective. One of the settings to prevent forgery</p>



<p>Syntax: g_from_noforgeme bool</p>



<h3 class="wp-block-heading">g_from_noforgename - If from contains two addresses the domains must match</h3>



<p>Prevents forgery where the descriptive name is a fake email address that doesn't match the real address</p>



<p>Syntax: g_from_noforgename bool</p>



<h3 class="wp-block-heading">g_from_nofriend - If forge setting would bounce message then allow message but don't allow friend match</h3>



<p>This setting modifies the g_from_noforgeme behaviour so it doesn't block the message but does prevent a friend match occurring</p>



<p>Syntax: g_from_nofriend bool</p>



<h3 class="wp-block-heading">g_from_ok - Whitelist for invalid from addresses we will permit</h3>



<p>This setting has no further documentation currently available</p>



<p>Syntax: g_from_ok string</p>



<h3 class="wp-block-heading">g_from_relay - If not authenticated and g_relay_allow_ip matched then block if not local domain or whitelisted</h3>



<p>This one helps prevent a local virus sending out spam. It basically says non authenticated users who can relay due to a g_relay_allow_ip rule must send from one of your domains or use smtp authentication or be in a white list. Note this test is performed on the message envelope not the body. We recommend insisting on smtp authentication to reduce your risk of this type of problem.</p>



<p>Syntax: g_from_relay bool</p>



<h3 class="wp-block-heading">g_from_relay_white - White list of domains for g_from_relay setting</h3>



<p>This is domains that can be used as a 'from' address for non authenticated users, in addition to local domains</p>



<p>Syntax: g_from_relay_white string</p>



<h3 class="wp-block-heading">g_from_rewrite - Rewrite from envelope for outgoing email, e.g. *@this.domain -&gt; %1@another.domain</h3>



<p>This lets you change the 'from' address from an internal domain name to a valid public domain name. The change is performed on the From envelope (return path), not the from header. And the chanage does not affect the return path written in local deliveries, only outgoing email. Mfilter rules can be used to rewrite the actual message headers.</p>



<p>Syntax: g_from_rewrite was=string to=string</p>



<h3 class="wp-block-heading">g_from_rewrite_header - Rewrite the from header as well</h3>



<p>Replaces the From: header in the mesage with the new address.</p>



<p>Syntax: g_from_rewrite_header bool</p>



<h3 class="wp-block-heading">g_from_rewrite_sender - Rewrite the sender header as well</h3>



<p>Replaces the Sender: header in the mesage with the new address.</p>



<p>Syntax: g_from_rewrite_sender bool</p>



<h3 class="wp-block-heading">g_from_stamp - Stamp if from is probably faked</h3>



<p>Stamp message with "X-Verify-Failed:" header if from address is probably faked.</p>



<p>eg: X-Verify-Failed: &lt;user@mydomain.com&gt; From mydomain.com is local but user not authenticated or from g_relay_allow_ip<br></p>



<p>This check is activated based on the same conditions as g_from_bounce.</p>



<p>Syntax: g_from_stamp bool</p>



<h3 class="wp-block-heading">g_from_timeout - Timeout on g_badfrom_* checks</h3>



<p>Timeout in seconds of g_badfrom_* checks. Default = 60 seconds. If this timeout is reached the g_badfrom check will be classed as having failed.</p>



<p>Syntax: g_from_timeout int</p>



<h3 class="wp-block-heading">g_from_valid - Require an @ and dotted domain in all return addresses</h3>



<p>This forces the sender to either give 'no' reply address or a valid one with an @ and a dotted domain</p>



<p>Syntax: g_from_valid bool</p>
<p>The post <a rel="nofollow" href="https://surgemail.com/knowledge-base/global-settings-g_from/">Global Settings g_from</a> appeared first on <a rel="nofollow" href="https://surgemail.com">SurgeMail</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
