<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/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Smtp on Stephen Ajulu</title><link>https://ajulu.netlify.app/tags/smtp/</link><atom:link href="https://ajulu.netlify.app/tags/smtp/feed.xml" rel="self" type="application/rss+xml"/><description>Hello, I'm Stephen Ajulu, a seasoned multidisciplinary tech professional with over a decade of experience. I build impactful solutions using design, tech, and engineering in the pursuit of impact.</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><managingEditor>ajulu.b22uf@aleeas.com (Stephen Ajulu)</managingEditor><webMaster>ajulu.b22uf@aleeas.com (Stephen Ajulu)</webMaster><copyright>Stephen Ajulu.</copyright><lastBuildDate>Thu, 10 Nov 2022 19:00:00 +0300</lastBuildDate><item><title>Koha: How To Setup Gmail Email Notices with Postfix</title><link>https://ajulu.netlify.app/posts/koha-how-to-setup-gmail-email-notices-with-postfix/</link><pubDate>Thu, 10 Nov 2022 19:00:00 +0300</pubDate><guid>https://ajulu.netlify.app/posts/koha-how-to-setup-gmail-email-notices-with-postfix/</guid><description>&lt;h2 id="1-installation-of-postfix-mail-server"&gt;&lt;strong&gt;1. Installation of postfix mail server&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Open a terminal and apply the following commands,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install postfix
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Select &amp;ldquo;no configuration&amp;rdquo; in the post-installation screen.&lt;/p&gt;
&lt;h2 id="2-copy-the-configuration-file"&gt;&lt;strong&gt;2. Copy the configuration file.&lt;/strong&gt;&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;sudo cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="3-install-the-following-packages-as-well"&gt;&lt;strong&gt;3. Install the following packages as well&lt;/strong&gt;&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;sudo apt-get install libsasl2-2 libsasl2-modules ca-certificates mailutils
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="4-open-the-following-file-and-add-a-few-lines"&gt;&lt;strong&gt;4. Open the following file and add a few lines.&lt;/strong&gt;&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;sudo nano /etc/postfix/main.cf
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the following lines at the bottom of the file.&lt;/p&gt;</description><content:encoded><![CDATA[<h2 id="1-installation-of-postfix-mail-server"><strong>1. Installation of postfix mail server</strong></h2>
<p>Open a terminal and apply the following commands,</p>
<pre><code>sudo apt-get update &amp;&amp; sudo apt-get install postfix
</code></pre>
<p>Select &ldquo;no configuration&rdquo; in the post-installation screen.</p>
<h2 id="2-copy-the-configuration-file"><strong>2. Copy the configuration file.</strong></h2>
<pre><code>sudo cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
</code></pre>
<h2 id="3-install-the-following-packages-as-well"><strong>3. Install the following packages as well</strong></h2>
<pre><code>sudo apt-get install libsasl2-2 libsasl2-modules ca-certificates mailutils
</code></pre>
<h2 id="4-open-the-following-file-and-add-a-few-lines"><strong>4. Open the following file and add a few lines.</strong></h2>
<pre><code>sudo nano /etc/postfix/main.cf
</code></pre>
<p>Add the following lines at the bottom of the file.</p>
<pre><code>relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
</code></pre>
<h2 id="5-configure-gmail"><strong>5. Configure Gmail</strong></h2>
<p>Now for Gmail to work with an SMTP server. One of two things must happen.</p>
<ol>
<li>For corporate accounts(Google Workspace for Business): You must go to &ldquo;Manage Account&rdquo; - &ldquo;Security&rdquo; and then allow less secure apps to access Gmail.</li>
<li>For normal/free accounts: You must enable 2-factor authentification and then set up an App Password.</li>
</ol>
<p>Open the following file and add the Google app password for Gmail.</p>
<pre><code>sudo nano /etc/postfix/sasl_passwd
</code></pre>
<p>Add the following line in the opened file.</p>
<pre><code>[smtp.gmail.com]:587 urgmailid@gmail.com:yourpassword
</code></pre>
<p>Add your Gmail username and password.</p>
<h2 id="6-change-the-permission-of-the-following-file"><strong>6. Change the permission of the following file.</strong></h2>
<pre><code>sudo chmod 400 /etc/postfix/sasl_passwd
</code></pre>
<h2 id="7-translate-the"><strong>7. Translate the <em>/etc/postfix/sasl_passwd</em> to Postfix lookup tables.</strong></h2>
<pre><code>sudo postmap /etc/postfix/sasl_passwd
</code></pre>
<h2 id="8-create-the"><strong>8. Create the <em>/etc/aliases.db</em></strong></h2>
<pre><code>sudo postalias hash:/etc/aliases
</code></pre>
<h2 id="9-create-the"><strong>9. Create the <em>/etc/postfix/cacert.pem</em></strong></h2>
<p>Here depends on the Ubuntu version and how recently it&rsquo;s been updated.</p>
<p>As such go to /etc/ssl/certs/ then find any certificate with <em>SecureCA.pem</em> then replace the Equifax section and place the one you&rsquo;ve found.</p>
<pre><code>sudo cat /etc/ssl/certs/Equifax_Secure_CA.pem &gt;&gt; /etc/postfix/cacert.pem
</code></pre>
<h2 id="10-restart-postfix"><strong>10. Restart Postfix.</strong></h2>
<pre><code>sudo /etc/init.d/postfix restart
</code></pre>
<h2 id="11-enable-email-service-in-koha"><strong>11. Enable email service in Koha</strong></h2>
<p>Execute the following command in a terminal</p>
<pre><code>sudo koha-email-enable library
</code></pre>
<h2 id="13-check-the-following-settings-in-koha-to-send-email-notices"><strong>13. Check the following settings in Koha to send email notices,</strong></h2>
<p><strong>Koha &gt; Administration &gt; Patron categories &gt; Overdue notice required &gt; Yes</strong><br>
[Check for each patron category]</p>
<img src="https://1.bp.blogspot.com/-X6HmNV23Gc0/WEGrylqX5NI/AAAAAAAAT74/r6TEsZN0mAAHVVxWNskVfnJWZIz39bFlACLcB/s640/Koha%2B%25E2%2580%25BA%2BAdministration%2B%25E2%2580%25BA%2BPatron%2Bcategories%2B%25E2%2580%25BA%2BMessaging%2Bpreferences.png" style="max-width:100%;height:auto;">
<p><strong>Koha Administration &gt; Global System Preferences &gt; Patrons &gt; Enhancedmessagingpreferences &gt; Allow</strong></p>
<p>Set <strong>Koha</strong> &gt; <strong>Tools</strong> &gt; [<strong>Overdue Notice/status triggers</strong>]</p>
<img src="https://1.bp.blogspot.com/-nika5CdbheM/WEGrO2reR_I/AAAAAAAAT70/TRcK_LeVDog6m7mFP6YdSZiBVaU_0ZoPwCLcB/s640/Koha%2B%25E2%2580%25BA%2BTools%2B%25E2%2580%25BA%2BNotice%2Btriggers.png" style="max-width:100%;height:auto;">
<h2 id="14-additional-smtp-setup"><strong>14. Additional SMTP Setup</strong></h2>
<p>Configure in the SMTP Server page under Additional parameters in Koha administration</p>
<p>Go to Home &ndash;&gt; Administration &ndash;&gt; Additional parameters &ndash;&gt; SMTP servers &ndash;&gt; New SMTP Server</p>
<p>Name: GMail</p>
<p>Host: smtp.gmail.com</p>
<p>Port: 465</p>
<p>SSL: SSL (authentication)</p>
<p>User name: <a href="mailto:libraryemail@gmail.com">libraryemail@gmail.com</a></p>
<p>Password: theapppassword</p>
<p>Update in the branch library details,</p>
<p>Go to Home &ndash;&gt; Administration &ndash;&gt; libraries &ndash;&gt; choose your library update SMTP server selecting the new one we have created</p>
<h2 id="14-test-the-configuration"><strong>14. Test the configuration</strong></h2>
<p>You can test the configuration by running the following command</p>
<pre><code>echo &quot;Test Postfix Gmail LIBRARY&quot; | mail -s &quot;Postfix Gmail SMTP Relay&quot; reciever@gmail.com
</code></pre>
<h5 id="you-are-ready-to-send-emails-from-koha-cheers"><strong>You are ready to send emails from koha, Cheers!</strong></h5>
<p>I also offer this setup as a service for $5: <a href="/contact"><strong>Contact me</strong></a></p>
]]></content:encoded><media:content url="https://ajulu.netlify.app/images/koha-user.jpg" medium="image"/></item></channel></rss>