    <?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>Email Archives - perkinstuff.com</title>
	<atom:link href="https://perkinstuff.com/category/email/feed/" rel="self" type="application/rss+xml" />
	<link>https://perkinstuff.com/category/email/</link>
	<description>I Do IT My Way</description>
	<lastBuildDate>Thu, 04 Jun 2020 19:11:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.12</generator>

<image>
	<url>https://perkinstuff.com/wp-content/uploads/2020/06/profile-pic-round-300-150x150.png</url>
	<title>Email Archives - perkinstuff.com</title>
	<link>https://perkinstuff.com/category/email/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Run A Cron Job With A &#8216;Random&#8217; Time Interval</title>
		<link>https://perkinstuff.com/run-a-cron-job-with-a-random-time-interval/</link>
					<comments>https://perkinstuff.com/run-a-cron-job-with-a-random-time-interval/#respond</comments>
		
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Wed, 05 Dec 2018 15:29:42 +0000</pubDate>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">https://www.perkinstuff.com/?p=116</guid>

					<description><![CDATA[<p>Here&#8217;s an interesting little Linux cron timing trick I found. For one reason and another, I had a requirement to run a test cron job but with irregular timing to simulate the real scenario of users connecting irregularly. The trick is to run the cron job on a normal regular interval, but then introduce a...</p>
<p>The post <a rel="nofollow" href="https://perkinstuff.com/run-a-cron-job-with-a-random-time-interval/">Run A Cron Job With A &#8216;Random&#8217; Time Interval</a> appeared first on <a rel="nofollow" href="https://perkinstuff.com">perkinstuff.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Here&#8217;s an interesting little Linux cron timing trick I found.</p>



<p>For one reason and another, I had a requirement to run a test cron job but with irregular timing to simulate the real scenario of users connecting irregularly.</p>



<p>The trick is to run the cron job on a normal regular interval, but then introduce a pause before it delivers the payload. So in the example below, the job runs every 10 minutes but pauses between 0 and 590 seconds. Thus making it appear semi-random.</p>



<p>First create a simple bash shell script, in say /home/me/demo.sh:</p>



<pre class="wp-block-code"><code>#!/bin/bash
sleep $(($RANDOM%590))s
echo "Hi this email was sent at ${CURRENTDATE}"</code></pre>



<p>The second line tells the script to wait for a random amount of time between 0 and 590 seconds.</p>



<p>It&#8217;s important to note that 590 seconds is slightly less than the 10 minute (600 seconds) interval we use in the crontab below which gives a maximum of 10 seconds before the next job starts. Unless you specifically want overlapping jobs, then it&#8217;s a good idea to adjust this to allow enough time for each job to complete before the next one!</p>



<p>Next, edit your crontab file:</p>



<pre class="wp-block-code"><code>crontab -e</code></pre>



<p>And add the lines:</p>



<pre class="wp-block-code"><code>MAILTO="&lt;email@domain.tld>"
10 * * * * * bash /home/me/demo.sh</code></pre>



<p>This will run the script and send an email at a random time every 10 minutes or so.</p>



<p>Obviously, you can add your own commands as required.</p>



<p>And as a Brucie bonus, note the MAILTO= setting on the first line. If you ever wondered how to get email notifications from your cron jobs, this is one simple way that will send all of the output created by the job to the email address configured!</p>



<p>Or you can suppress any emails by setting it to MAILTO=&#8221;&#8221;.</p>



<p>And anyway that&#8217;s it! Happy cron-ing!</p>



<hr class="wp-block-separator has-text-color has-background has-very-light-gray-background-color has-very-light-gray-color"/>



<div class="wp-block-columns">
<div class="wp-block-column" style="flex-basis:15%">
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="https://perkinstuff.com/wp-content/uploads/2020/06/contribute.png" alt="Buy me a coffee" class="wp-image-256" width="50" height="70"/></figure></div>
</div>



<div class="wp-block-column" style="flex-basis:85%">
<h2>Found This Useful?</h2>



<p>If you have found this useful, why not help to support the site and <a href="/buy-me-a-coffee">buy me a coffee or perhaps a cheeky beer</a>? Thanks!</p>
</div>
</div>



<p></p>



<div class="wp-block-columns">
<div class="wp-block-column" style="flex-basis:15%">
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" src="https://perkinstuff.com/wp-content/uploads/2020/10/logo-v2-90.png" alt="" class="wp-image-337" width="50" height="50"/></figure></div>
</div>



<div class="wp-block-column" style="flex-basis:85%">
<h2>Websites Built For You</h2>



<p>You may also like <a href="https://websitesbuiltforyou.com">Websites Built For You </a>which focuses on web design and development in WordPress, PHP and Javascript.</p>
</div>
</div>



<p></p>
<p>The post <a rel="nofollow" href="https://perkinstuff.com/run-a-cron-job-with-a-random-time-interval/">Run A Cron Job With A &#8216;Random&#8217; Time Interval</a> appeared first on <a rel="nofollow" href="https://perkinstuff.com">perkinstuff.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://perkinstuff.com/run-a-cron-job-with-a-random-time-interval/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Completely Disable ClamAV In iRedMail</title>
		<link>https://perkinstuff.com/completely-disable-clamav-iredmail/</link>
					<comments>https://perkinstuff.com/completely-disable-clamav-iredmail/#comments</comments>
		
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Tue, 22 May 2018 16:30:13 +0000</pubDate>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">https://www.perkinstuff.com/?p=98</guid>

					<description><![CDATA[<p>ClamAV can be a memory hog at the best of times. If your mail server is feeling the pinch then there is a useful article in iRedMail&#8217;s own documentation on disabling it: Completely Disable ClamAV In iRedMail However, I have found that whilst the steps work, they don&#8217;t go quite far enough. The problem is...</p>
<p>The post <a rel="nofollow" href="https://perkinstuff.com/completely-disable-clamav-iredmail/">Completely Disable ClamAV In iRedMail</a> appeared first on <a rel="nofollow" href="https://perkinstuff.com">perkinstuff.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>ClamAV can be a memory hog at the best of times. If your mail server is feeling the pinch then there is a useful article in iRedMail&#8217;s own documentation on disabling it:</p>



<p><a href="https://docs.iredmail.org/completely.disable.amavisd.clamav.spamassassin.html">Completely Disable ClamAV In iRedMail</a></p>



<p>However, I have found that whilst the steps work, they don&#8217;t go quite far enough. The problem is that although the changes stop iRedMail from scanning mails for viruses, they leave ClamAV running in the background.</p>



<p>This means it can still eat up excessive amounts of memory getting ready to do, well nothing!</p>



<h2>Completely Disable ClamAV</h2>



<p>Just one extra step can completely stop the unwanted service and free up all that precious memory:</p>



<pre class="wp-block-preformatted">sudo update-rc.d clamav-daemon disable
sudo update-rc.d clamav-freshclam disable</pre>



<p>Thanks for reading, only a short article but I spent a lot of time working it out so hope it&#8217;s useful to some people!</p>



<hr class="wp-block-separator has-text-color has-background has-very-light-gray-background-color has-very-light-gray-color"/>



<div class="wp-block-columns">
<div class="wp-block-column" style="flex-basis:15%">
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" src="https://perkinstuff.com/wp-content/uploads/2020/06/contribute.png" alt="Buy me a coffee" class="wp-image-256" width="50" height="70"/></figure></div>
</div>



<div class="wp-block-column" style="flex-basis:85%">
<h2>Found This Useful?</h2>



<p>If you have found this useful, why not help to support the site and <a href="/buy-me-a-coffee">buy me a coffee or perhaps a cheeky beer</a>? Thanks!</p>
</div>
</div>



<p></p>



<div class="wp-block-columns">
<div class="wp-block-column" style="flex-basis:15%">
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" src="https://perkinstuff.com/wp-content/uploads/2020/10/logo-v2-90.png" alt="" class="wp-image-337" width="50" height="50"/></figure></div>
</div>



<div class="wp-block-column" style="flex-basis:85%">
<h2>Websites Built For You</h2>



<p>You may also like <a href="https://websitesbuiltforyou.com">Websites Built For You </a>which focuses on web design and development in WordPress, PHP and Javascript.</p>
</div>
</div>



<p></p>
<p>The post <a rel="nofollow" href="https://perkinstuff.com/completely-disable-clamav-iredmail/">Completely Disable ClamAV In iRedMail</a> appeared first on <a rel="nofollow" href="https://perkinstuff.com">perkinstuff.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://perkinstuff.com/completely-disable-clamav-iredmail/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Nullmailer: A Simple Mail Transfer Agent</title>
		<link>https://perkinstuff.com/nullmailer-simple-mail-transfer-agent/</link>
					<comments>https://perkinstuff.com/nullmailer-simple-mail-transfer-agent/#respond</comments>
		
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Fri, 18 May 2018 06:20:21 +0000</pubDate>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">https://www.perkinstuff.com/?p=72</guid>

					<description><![CDATA[<p>Sometimes all you want to do is to allow your server to send emails. Postfix, exim and sendmail can all be configured to do this but they are complex to configure and relatively heavy-weight just to be used as a simple outgoing message transfer agent (MTA). This is where nullmailer comes in handy. Nullmailer is...</p>
<p>The post <a rel="nofollow" href="https://perkinstuff.com/nullmailer-simple-mail-transfer-agent/">Nullmailer: A Simple Mail Transfer Agent</a> appeared first on <a rel="nofollow" href="https://perkinstuff.com">perkinstuff.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Sometimes all you want to do is to allow your server to send emails. Postfix, exim and sendmail can all be configured to do this but they are complex to configure and relatively heavy-weight just to be used as a simple outgoing message transfer agent (MTA). This is where nullmailer comes in handy.</p>



<p>Nullmailer is a tiny MTA that is a drop in replacement for the more complex mailers mentioned above. All that it does is accept outgoing mails and forward them via your normal SMTP mail relay server. The examples in this article are based on Debian Linux but should be helpful with other distros as well.</p>



<p>It&#8217;s easy to install:</p>



<pre class="wp-block-preformatted">sudo apt-get install nullmailer</pre>



<p>Any other mail transfer agent you have installed will be removed as part of the install process.</p>



<h2>Configuration (/etc/nullmailer)</h2>



<p>Once installed you can modify the configuration files in /etc/nullmailer.</p>



<h3>/etc/nullmailer/remotes</h3>



<p>This is where you configure the remote mail relay server that your outgoing emails are forwarded through:</p>



<pre class="wp-block-preformatted">&lt;your relay mailserver&gt; smtp --starttls --insecure --port=&lt;portno&gt; --user=&lt;username&gt; --pass=&lt;password&gt;</pre>



<p>If you have control over the relay server then I find it easier to leave off the &#8211;user and &#8211;pass options and instead whitelist the sender IP address.</p>



<h3>/etc/nullmailer/helohost</h3>



<p>This is where you configure how your server will identify itself when connecting to the remote relay host. This is used when connecting to the remote relay server and literally controls the name used in the SMTP HELO command:</p>



<pre class="wp-block-preformatted">myserver.domain.tld</pre>



<p>Will connect to the remote relay server using:</p>



<pre class="wp-block-preformatted">HELO myserver.domain.tld</pre>



<p>It&#8217;s best to use the fully qualified domain name of the server here, as defined in DNS. Ideally also add a PTR (reverse lookup) record that resolves to the same.</p>



<p>And that&#8217;s all! Just a little bit easier than postfix, sendmail or exim!</p>



<p>There are other configuration options as well, but I&#8217;ve never found them necessary. There is a link to more information about that at the end of this article.</p>



<h2>Testing</h2>



<p>You can send a simple test email from the command prompt using the following:</p>



<pre class="wp-block-preformatted">mail -s "Some subject" -a "From: &lt;your from email address&gt;" &lt;your to email address&gt;</pre>



<p>so as an example</p>



<pre class="wp-block-preformatted">mail -s "Some subject" -a "From: &lt;steve@senderaddress.tld&gt;" &lt;test@receipientaddress.tld&gt;</pre>



<p>You will then be prompted to enter a Cc: address (use ENTER to leave blank) and the email content (use CTRL+D to finish). Hopefully if you have everything set up correctly, the email will arrive in your inbox. It&#8217;s a good idea to also test using an external recipient mailbox located on another server just to ensure that the emails are being relayed correctly.</p>



<h2>Mail Queue</h2>



<p>All mails sent through nullmailer are processed into the mail queue directory. On Debian this is in /etc/spool/nullmailer/queue.</p>



<p>There is no timeout on sending mails, so if there is a problem with delivery it will keep retrying forever. The simple solution to this is a daily cron job such as below which will delete all emails in the queue older than 24 hours:</p>



<pre class="wp-block-preformatted">find /var/spool/nullmailer/queue -mindepth 1 -mtime +1 -delete</pre>



<p>You could also modify this to just copy the mails somewhere else for your perusal. In my experience&nbsp;it&#8217;s not necessary though as it&#8217;s only occasional system alerts using email address such as root@localhost that get stuck.</p>



<h2>Need More?</h2>



<p>There are some great articles on using nullmailer that go into a lot more technical detail at&nbsp;<a href="http://troubleshooters.com/linux/nullmailer/#_Configuring_Nullmailer">http://troubleshooters.com/linux/nullmailer/#_Configuring_Nullmailer</a></p>



<hr class="wp-block-separator has-text-color has-background has-very-light-gray-background-color has-very-light-gray-color"/>



<div class="wp-block-columns">
<div class="wp-block-column" style="flex-basis:15%">
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" src="https://perkinstuff.com/wp-content/uploads/2020/06/contribute.png" alt="Buy me a coffee" class="wp-image-256" width="50" height="70"/></figure></div>
</div>



<div class="wp-block-column" style="flex-basis:85%">
<h2>Found This Useful?</h2>



<p>If you have found this useful, why not help to support the site and <a href="/buy-me-a-coffee">buy me a coffee or perhaps a cheeky beer</a>? Thanks!</p>
</div>
</div>



<p></p>



<div class="wp-block-columns">
<div class="wp-block-column" style="flex-basis:15%">
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" src="https://perkinstuff.com/wp-content/uploads/2020/10/logo-v2-90.png" alt="" class="wp-image-337" width="50" height="50"/></figure></div>
</div>



<div class="wp-block-column" style="flex-basis:85%">
<h2>Websites Built For You</h2>



<p>You may also like <a href="https://websitesbuiltforyou.com">Websites Built For You </a>which focuses on web design and development in WordPress, PHP and Javascript.</p>
</div>
</div>



<p></p>
<p>The post <a rel="nofollow" href="https://perkinstuff.com/nullmailer-simple-mail-transfer-agent/">Nullmailer: A Simple Mail Transfer Agent</a> appeared first on <a rel="nofollow" href="https://perkinstuff.com">perkinstuff.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://perkinstuff.com/nullmailer-simple-mail-transfer-agent/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
