<?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>Linux Admin Zone &#187; mail</title>
	<atom:link href="http://linuxadminzone.com/category/mail/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxadminzone.com</link>
	<description>Adding more reasons to celebrate Open Source.</description>
	<lastBuildDate>Wed, 09 May 2012 10:17:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>quickly setup relay/smarthost with smtp auth in postfix mail server</title>
		<link>http://linuxadminzone.com/quickly-setup-relaysmarthost-with-smtp-auth-in-postfix-mail-server/</link>
		<comments>http://linuxadminzone.com/quickly-setup-relaysmarthost-with-smtp-auth-in-postfix-mail-server/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 11:20:03 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[mail]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[relay]]></category>
		<category><![CDATA[smarthost]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=260</guid>
		<description><![CDATA[When we decided to host our mail with some other provider, the question of configuring our web servers to use that provider to send mail arise. Having CentOS and postfix as mail service in our hosts, we followed these steps to tell local postfix to use other smtp service to send mails. 1. Suppose you [...]]]></description>
			<content:encoded><![CDATA[<p>When we decided to host our mail with some other provider, the question of configuring our web servers to use that provider to send mail arise. Having CentOS and postfix as mail service in our hosts, we followed these steps to tell local postfix to use other smtp service to send mails. </p>
<p>1. Suppose you have example.com domain, create one separate mail account to be used in your scripts residing on web server for sending mails. As an example, let&#8217;s assume we have mailer@example.com with password mailer123 and mail server address as mail.example.com. Here mail.example.com points to provider mail server which is managing our mail infrastructure. Create a password map file which will contain this information:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi /etc/postfix/relaypwd</span>
mail.example.com     mailer:mailer123</pre></div></div>

<p>2. Check that permissions are ok for that file, or you can set them quickly:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chown root:root /etc/postfix/relaypwd; chmod 600 /etc/postfix/relaypwd</span></pre></div></div>

<p>3. Create hash from this password file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># postmap /etc/postfix/relaypwd</span></pre></div></div>

<p>4. Change/add following configs in your main.cf file, remember that these config may exist already so update them with your values or uncomment them:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi /etc/postfix/main.cf</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">relayhost = <span style="color: #7a0874; font-weight: bold;">&#91;</span>mail.example.com<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
smtpd_sasl_auth_enable = <span style="color: #c20cb9; font-weight: bold;">yes</span>
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = <span style="color: #007800;">$myhostname</span>
smtp_sasl_auth_enable = <span style="color: #c20cb9; font-weight: bold;">yes</span>
smtp_sasl_security_options =
smtp_sasl_password_maps = <span style="color: #7a0874; font-weight: bold;">hash</span>:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>relaypwd
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = <span style="color: #000000;">256000000</span>
myorigin = example.com</pre></div></div>

<p>5. Restart the postfix service to apply changes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># service postfix restart</span></pre></div></div>

<p>6. Your server now should use the configured mail service to send mails, I&#8217;ve already posted one article <a href="http://linuxadminzone.com/quickly-check-your-mail-server-using-telnet-mail-or-mutt/">here</a> to <a href="http://linuxadminzone.com/quickly-check-your-mail-server-using-telnet-mail-or-mutt/">test your mail service</a> completely. Please get confirmed before marking it as done. </p>
<p>More related articles: </p>
<p>* <a href="http://linuxadminzone.com/top-5-most-useful-commands-tools-for-linux-administrators/">Top 5 most useful tools for Linux Admin</a><br />
* <a href="http://linuxadminzone.com/detect-directory-or-file-changes-in-linuxunix/">Detect directory changes in Linux</a><br />
* <a href="http://linuxadminzone.com/setting-up-a-mysql-cluster-7-0-in-redhat-based-linux/">Setup MySQL Cluster</a><br />
* <a href="http://linuxadminzone.com/setting-up-mutiple-mysql-database-servers-on-a-single-linux-machine/">Setup multiple MySQL servers in single host</a><br />
* <a href="http://linuxadminzone.com/recover-or-reset-root-password-of-mysql-and-postgresql-servers/">Recover or reset MySQL/PostgreSQL root password</a><br />
* <a href="http://linuxadminzone.com/exim-for-normal-mail-but-stop-for-secure-smtp-server/">Use exim for normal mail, not for secure smtp service</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/quickly-setup-relaysmarthost-with-smtp-auth-in-postfix-mail-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>quickly check your mail server using telnet, mail or mutt</title>
		<link>http://linuxadminzone.com/quickly-check-your-mail-server-using-telnet-mail-or-mutt/</link>
		<comments>http://linuxadminzone.com/quickly-check-your-mail-server-using-telnet-mail-or-mutt/#comments</comments>
		<pubDate>Sun, 31 Oct 2010 13:03:00 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=254</guid>
		<description><![CDATA[There are of course various ways to check whether your mail server is now configured ok or not but what I found is that checking through telnet is quick and easy. let&#8217;s check our mail server now, it may be mail.youdomain.com or localhost depending on what you are using right now, here&#8217;s the full process: [...]]]></description>
			<content:encoded><![CDATA[<p>There are of course various ways to check whether your mail server is now configured ok or not but what I found is that checking through telnet is quick and easy. </p>
<p>let&#8217;s check our mail server now, it may be mail.youdomain.com or localhost depending on what you are using right now, here&#8217;s the full process:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># telnet localhost smtp</span>
Trying 127.0.0.1...
Connected to localhost.
Escape character is <span style="color: #ff0000;">'^]'</span>.
<span style="color: #000000;">220</span> mail.example.com ESMTP Postfix
mail from: me<span style="color: #000000; font-weight: bold;">@</span>example.com
<span style="color: #000000;">250</span> 2.1.0 Ok
rcpt to: other<span style="color: #000000; font-weight: bold;">@</span>example.com
<span style="color: #000000;">250</span> 2.1.5 Ok
data
<span style="color: #000000;">354</span> End data with <span style="color: #000000; font-weight: bold;">&lt;</span>CR<span style="color: #000000; font-weight: bold;">&gt;&lt;</span>LF<span style="color: #000000; font-weight: bold;">&gt;</span>.<span style="color: #000000; font-weight: bold;">&lt;</span>CR<span style="color: #000000; font-weight: bold;">&gt;&lt;</span>LF<span style="color: #000000; font-weight: bold;">&gt;</span>
Subject: Just a test. 
This is <span style="color: #7a0874; font-weight: bold;">test</span> mail using telnet.  
.
<span style="color: #000000;">250</span> 2.0.0 Ok: queued <span style="color: #c20cb9; font-weight: bold;">as</span> 6846838401D6
quit
<span style="color: #000000;">221</span> 2.0.0 Bye
Connection closed by foreign host.
<span style="color: #666666; font-style: italic;">#_</span></pre></div></div>

<p>here,</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># telnet localhost smtp</span></pre></div></div>

<p>We are trying connecting localhost on port 25 (smtp). It should get connected and ready to accept your next command</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mail from: me<span style="color: #000000; font-weight: bold;">@</span>example.com</pre></div></div>

<p>here you are specifying the sender mail id, it should be a valid mail account otherwise mail server can reject the sender address.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rcpt to: other<span style="color: #000000; font-weight: bold;">@</span>example.com</pre></div></div>

<p>This is the recipient mail address.<br />
then write &#8216;data&#8217; and then in new line write &#8216;Subject: your subject&#8217;, press Enter and start writing contents of your mail. when you want to close, write a dot (.) and press Enter. message should be sent/queued in mail queue.<br />
Check the recipient mail address, if mail server is working ok, you should get this mail there. </p>
<p>Other than this method where you can quickly use mail command also, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># echo &quot;This is a test mail to check mail server.&quot; | mail - s &quot;This is test subject&quot; other@example.com</span></pre></div></div>

<p>This is a single line command but alas! we didn&#8217;t supply sender here which may trigger rejection from mail server. </p>
<p>You can also use mutt tool to facilitate this, if its there in your machine, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># mutt -s &quot;Test mail&quot; other@example.com &lt; message.txt</span></pre></div></div>

<p>here message.txt contains mail message. </p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/quickly-check-your-mail-server-using-telnet-mail-or-mutt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QuickTip use exim for normal mail but stop for secure smtp server</title>
		<link>http://linuxadminzone.com/exim-for-normal-mail-but-stop-for-secure-smtp-server/</link>
		<comments>http://linuxadminzone.com/exim-for-normal-mail-but-stop-for-secure-smtp-server/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 07:38:57 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[mail]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[ssmtp]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=165</guid>
		<description><![CDATA[Isn&#8217;t this weird? most people ask how to configure a mail server for secure smtp but one of my friend told me that he has a server which running Exim mail server on both port 25 (normal) and port 465 (secure smtp) now he is facing difficulties because the SSL certificates which Exim uses are [...]]]></description>
			<content:encoded><![CDATA[<p>Isn&#8217;t this weird? most people ask how to configure a mail server for secure smtp but one of my friend told me that he has a server which running Exim mail server on both port 25 (normal) and port 465 (secure smtp) now he is facing difficulties because the SSL certificates which Exim uses are expired. He wanted to close port 465 without affecting port 25 used by their scripts. </p>
<p>Here&#8217;s what I did and worked but if you have better idea or something to add, I&#8217;ll be glad to hear. </p>
<p>1. Check that Exim is listening on which ports or which ports are open:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># netstat -ant | grep LIST</span>
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 0.0.0.0:<span style="color: #000000;">3306</span>                0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>                   LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 0.0.0.0:<span style="color: #000000;">587</span>                 0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>                   LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 0.0.0.0:<span style="color: #000000;">10000</span>               0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>                   LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 0.0.0.0:<span style="color: #000000;">465</span>                 0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>                   LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 0.0.0.0:<span style="color: #000000;">25</span>                  0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>                   LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">587</span>                      :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">80</span>                       :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">465</span>                      :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">22</span>                       :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">25</span>                       :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">443</span>                      :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN</pre></div></div>

<p>here port 25, 465 and 587 are used by exim (mail server). how to know which ports are used by which program? </p>
<p>simple, use lsof command. like we want to know which program is listening on port 25:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># lsof -i :25</span>
COMMAND   PID USER   FD   TYPE  DEVICE SIZE NODE NAME
exim    <span style="color: #000000;">11290</span> exim    3u  IPv6 <span style="color: #000000;">7144552</span>       TCP <span style="color: #000000; font-weight: bold;">*</span>:smtp <span style="color: #7a0874; font-weight: bold;">&#40;</span>LISTEN<span style="color: #7a0874; font-weight: bold;">&#41;</span>
exim    <span style="color: #000000;">11290</span> exim    4u  IPv4 <span style="color: #000000;">7144553</span>       TCP <span style="color: #000000; font-weight: bold;">*</span>:smtp <span style="color: #7a0874; font-weight: bold;">&#40;</span>LISTEN<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>so its Exim. </p>
<p>2. Open config file for exim (/etc/exim/exim.conf on redhat based distros) and search and comment out following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>exim<span style="color: #000000; font-weight: bold;">/</span>exim.conf
  tls_advertise_hosts = <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #666666; font-style: italic;">## comment this line to prevent clients connecting for tls</span>
&nbsp;
  tls_certificate = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>exim.pem  <span style="color: #666666; font-style: italic;">## comment, we dont need to specify ssl certificates</span>
  tls_privatekey = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>exim.pem <span style="color: #666666; font-style: italic;">## comment</span>
&nbsp;
  daemon_smtp_ports = <span style="color: #000000;">25</span> : <span style="color: #000000;">465</span> : <span style="color: #000000;">587</span>  <span style="color: #666666; font-style: italic;">## comment this line, copy and paste in next line but with only 25 as port number</span>
  tls_on_connect_ports = <span style="color: #000000;">465</span>  <span style="color: #666666; font-style: italic;">## comment, we dont need tls on port 465</span></pre></div></div>

<p>so after commenting/updating, the above lines should look line below in /etc/exim/exim.conf file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
  <span style="color: #666666; font-style: italic;"># tls_advertise_hosts = *</span>
&nbsp;
  <span style="color: #666666; font-style: italic;"># tls_certificate = /etc/pki/tls/certs/exim.pem  ## comment, we dont need to specify ssl certificates</span>
  <span style="color: #666666; font-style: italic;"># tls_privatekey = /etc/pki/tls/private/exim.pem ## comment</span>
&nbsp;
  <span style="color: #666666; font-style: italic;"># daemon_smtp_ports = 25 : 465 : 587  ## comment this line, copy and paste in next line but with only 25 as port number</span>
  <span style="color: #666666; font-style: italic;"># tls_on_connect_ports = 465  ## comment, we dont need tls on port 465</span>
&nbsp;
  daemon_smtp_ports = <span style="color: #000000;">25</span>  <span style="color: #666666; font-style: italic;">## dont comment this.</span></pre></div></div>

<p>3. Restart exim server and check open ports again:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/init.d/exim restart</span>
Shutting down exim:                                        <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span>
Starting exim:                                             <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ds-<span style="color: #000000;">29142</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># netstat -ant | grep LIST</span>
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 0.0.0.0:<span style="color: #000000;">3306</span>                0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>                   LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 0.0.0.0:<span style="color: #000000;">10000</span>               0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>                   LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 0.0.0.0:<span style="color: #000000;">25</span>                  0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>                   LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">80</span>                       :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">22</span>                       :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">25</span>                       :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN      
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> :::<span style="color: #000000;">443</span>                      :::<span style="color: #000000; font-weight: bold;">*</span>                        LISTEN</pre></div></div>

<p>Port 465 is not there now, so we have stopped secure stmp service in this host.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/exim-for-normal-mail-but-stop-for-secure-smtp-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

