blob: 19891f5530024604288b47353749e0e1d6679995 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Generated by Apache Maven Doxia at Apr 12, 2012 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>James Server -
Sendmail integration</title>
<style type="text/css" media="all">
@import url("./css/james.css");
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/site.css");
@import url("./js/jquery/css/custom-theme/jquery-ui-1.8.5.custom.css");
@import url("./js/jquery/css/print.css");
@import url("./js/fancybox/jquery.fancybox-1.3.4.css");
</style>
<script type="text/javascript" src="./js/jquery/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="./js/jquery/js/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" src="./js/fancybox/jquery.fancybox-1.3.4.js"></script>
<link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
<meta name="author" content="Danny Angus" />
<meta name="Date-Revision-yyyymmdd" content="20120412" />
<meta http-equiv="Content-Language" content="en" />
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1384591-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script').item(0); s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="composite">
<div id="banner">
<a href="index.html" id="bannerLeft" title="james-server-logo.gif">
<img src="images/logos/james-server-logo.gif" alt="James Server" />
</a>
<a href="http://www.apache.org/" id="bannerRight">
<img src="images/logos/asf-logo-reduced.gif" alt="The Apache Software Foundation" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 2012-04-12</span>
&nbsp;| <span id="projectVersion">Version: 1.6</span>
</div>
<div class="xright"> <a href="../index.html" title="Home">Home</a>
|
<a href="index.html" title="Server">Server</a>
|
<a href="../hupa/index.html" title="Hupa">Hupa</a>
|
<a href="../protocols/index.html" title="Protocols">Protocols</a>
|
<a href="../imap/index.html" title="IMAP">IMAP</a>
|
<a href="../mailet/index.html" title="Mailets">Mailets</a>
|
<a href="../mailbox/index.html" title="Mailbox">Mailbox</a>
|
<a href="../mime4j/index.html" title="Mime4J">Mime4J</a>
|
<a href="../jsieve/index.html" title="jSieve">jSieve</a>
|
<a href="../jspf/index.html" title="jSPF">jSPF</a>
|
<a href="../jdkim/index.html" title="jDKIM">jDKIM</a>
|
<a href="../mpt/index.html" title="MPT">MPT</a>
|
<a href="../postage/index.html" title="Postage">Postage</a>
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>James Server</h5>
<ul>
<li class="none">
<a href="index.html" title="Overview">Overview</a>
</li>
<li class="none">
<a href="design_objectives.html" title="Objectives">Objectives</a>
</li>
<li class="none">
<a href="FAQ.html" title="Server FAQ">Server FAQ</a>
</li>
<li class="none">
<a href="rfclist.html" title="Useful RFCs">Useful RFCs</a>
</li>
<li class="none">
<a href="http://issues.apache.org/jira/browse/JAMES" title="Issue Tracker">Issue Tracker</a>
</li>
<li class="none">
<a href="http://svn.apache.org/viewvc/james/server/" title="Source">Source</a>
</li>
</ul>
<h5>Documentation</h5>
<ul>
<li class="none">
<a href="3/index.html" title="Server v3">Server v3</a>
</li>
<li class="none">
<a href="2/index.html" title="Server v2">Server v2</a>
</li>
<li class="none">
<a href="archive/document_archive.html" title="Archive">Archive</a>
</li>
</ul>
<h5>About James</h5>
<ul>
<li class="none">
<a href="../index.html" title="Overview">Overview</a>
</li>
<li class="none">
<a href="../newsarchive.html" title="News">News</a>
</li>
<li class="none">
<a href="../mail.html" title="Mailing Lists">Mailing Lists</a>
</li>
<li class="none">
<a href="../contribute.html" title="Contributing">Contributing</a>
</li>
<li class="none">
<a href="../guidelines.html" title="Guidelines">Guidelines</a>
</li>
<li class="none">
<a href="http://wiki.apache.org/james" title="Wiki">Wiki</a>
</li>
<li class="none">
<a href="../weare.html" title="Who We Are">Who We Are</a>
</li>
<li class="none">
<a href="../license.html" title="License">License</a>
</li>
</ul>
<h5>Download</h5>
<ul>
<li class="none">
<a href="../download.cgi" title="Releases">Releases</a>
</li>
<li class="none">
<a href="http://people.apache.org/builds/james/nightly/" title=""></a>
</li>
</ul>
<h5>Apache Software Foundation</h5>
<ul>
<li>
<strong>
<a title="ASF" href="http://www.apache.org/">ASF</a>
</strong>
</li>
<li>
<a title="Get Involved" href="http://www.apache.org/foundation/getinvolved.html">Get Involved</a>
</li>
<li>
<a title="FAQ" href="http://www.apache.org/foundation/faq.html">FAQ</a>
</li>
<li>
<a title="License" href="http://www.apache.org/licenses/" >License</a>
</li>
<li>
<a title="Sponsorship" href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a>
</li>
<li>
<a title="Thanks" href="http://www.apache.org/foundation/thanks.html">Thanks</a>
</li>
<li>
<a title="Security" href="http://www.apache.org/security/">Security</a>
</li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<!-- Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License. -->
<div class="section"><h2>Preliminary Note<a name="Preliminary_Note"></a></h2>
<p>This information contained in this document is outdated.</p>
<p>It describes how to configure a version of sendmail that is no more the current one.</p>
<p>Moreover, some distributions are now replacing sendmail with Postfix.</p>
<p>For up-to-date information, please refer to the sendmail and/or postfix documentation.</p>
</div>
<div class="section"><h2>The problem<a name="The_problem"></a></h2>
<p>
This document explains how to configure sendmail to route all mail generated by /usr/sbin/sendmail or local mail on a host through James on the same host, including mail to local addresses without @host.<br />
All sendmail configuration file locations are for Redhat Linux 7.2, other installations may have different locations.<br />
<b>We take no responsibility for the quality of the information in this document. </b><br /><b>You should back-up any configuration files *before* you alter them.</b>
</p>
</div>
<div class="section"><h2>Solution<a name="Solution"></a></h2>
<div class="section"><h3>Step 1: Stop sendmail from running as an SMTP daemon<a name="Step_1:_Stop_sendmail_from_running_as_an_SMTP_daemon"></a></h3>
<p>
Ok so you want to use James for everything, including delivering mail from localhost to local users.<br />
Well the first step is to stop sendmail from starting up as the SMTP Daemon on port 25, otherwise it will route mail to itself and who knows what will happen then.<br />
Open the sendmail configuration file <b>/etc/sysconfig/sendmail</b>
Change the line:</p><div class="source"><pre>DAEMON=yes</pre></div>into<div class="source"><pre>DAEMON=no</pre></div>
Restart sendmail with:<div class="source"><pre>[root@apache root]# /etc/rc.d/init.d/sendmail restart</pre></div>This will make sendmail process its outgoing queue, but not listen on port 25 for incoming mail.
</div>
<div class="section"><h3>Step 2: Set up sendmail to use relay<a name="Step_2:_Set_up_sendmail_to_use_relay"></a></h3>
<p>
Ok, so far so good, now you need to tell sendmail to relay everything, regardless of its rules, through James. James will take the roles of &quot;local relay&quot; (destination for all unqualified local addresses), &quot;mail hub&quot; (destination for all qualified local addresses) and &quot;smart relay&quot; (destination for all other mail) for this instance of sendmail, thereby catching everything.<br />
So open <b>/etc/sendmail.cf</b> and..
</p><ul>
<li>Look for the line beginning <b>DS</b> make this line <b>DSesmtp:localhost</b></li>
<li>Look for the line beginning <b>DR</b> make this line <b>DResmtp:localhost</b></li>
<li>Look for the line beginning <b>DH</b> make this line <b>DHesmtp:localhost</b></li>
</ul>
Now that wasn't too hard was it?<br />
What we have done is to tell sendmail to use its &quot;mailer&quot; called <b>esmtp</b> to relay mail using ESMTP to localhost for each role.<br />
Of course no-one in their right mind would relay mail to localhost, because it would loop forever right?
</div>
<div class="section"><h3>Step 3: Stop sendmail complaining about mail apparently looping back<a name="Step_3:_Stop_sendmail_complaining_about_mail_apparently_looping_back"></a></h3>
<p>
The developers of sendmail have, wisely, built sendmail in such a way as to prevent, by default, mail being sent by sendmail back to itself, this is done by making a quick check on outgoing mail to see if its destination is our machine. If it is you'll see this message <b><i>config error: mail loops back to me</i></b> when you try to send mail.<br />
But we *want* to relay mail to localhost, and because sendmail isn't receiving our mail, James is, we won't be creating a loop. (make sure you've followed step one though).<br />
So open <b>/etc/sendmail.cf</b> again and go to the bottom of the file, start scrolling upwards until you see the declaration of the esmtp mailer it'll look something like this
</p><div class="source"><pre>
Mesmtp, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
T=DNS/RFC822/SMTP,
A=TCP $h
</pre></div>
You need to change it so its more like this: :-D
<div class="source"><pre>
Mesmtp, P=[IPC], F=kmDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
T=DNS/RFC822/SMTP,
A=TCP $h
</pre></div>
But seriously, we've added a <b>k</b> to the &quot;F=&quot; list <b>F=mDFMuXa</b> becomes <b>F=kmDFMuXa</b><br />
And again, thats it, sendmail will now skip the loopback test on mail leaving through the esmtp mailer.
<p>Now you have to make some tests.<br />Try each of the following, replace names in [] with names of the kind described.
</p><div class="source"><pre>/[root@apache root]# mail -v [real-localusername]
[root@apache root]# mail -v [nonexistant-localusername]
[root@apache root]# mail -v [real-localusername]@localhost
[root@apache root]# mail -v [real-localusername]@[myhostname.mydomainname]
[root@apache root]# mail -v [real-username]@[real-remote-account]
</pre></div>
Sendmail echoes each conversation to STDOUT so you can see what its trying to do with each mail.<br />
</div>
<div class="section"><h3>Step 4: If that wasn't enough James requires SMTP AUTH<a name="Step_4:_If_that_wasnt_enough_James_requires_SMTP_AUTH"></a></h3>
<p>
SMTP AUTH is a different Kettle of Fish.<br />
The scenario is that you're using SMTP AUTH on James to restrict SMTP relaying to authenticated users, allowing them to connect from any IP address but still not letting James become an open relay for spam, cool.<br />
However you now want to let sendmail relay through James, so you need to tell it how to authenticate.<br />
So open <b>/etc/sendmail.cf</b> <i>again</i> and this time..
</p><ul>
<li>Look for the line beginning <b>O AuthMechanisms=</b> If this line is commented out with a leading <b>#</b>, remove the <b>#</b> then make sure LOGIN and PLAIN are at the beginning of this line like this <b>O AuthMechanisms=LOGIN PLAIN GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5</b></li>
<li>Look for the line beginning <b>O DefaultAuthInfo=</b> If this line is commented out with a leading <b>#</b>, remove the <b>#</b> then make this line <b>O DefaultAuthInfo=/etc/mail/default-auth-info</b></li>
<li>Create a user account on James for sendmail to login as.</li>
<li>Create the file <b>/etc/mail/default-auth-info</b></li>
<li>It should contain this<div class="source"><pre>username
username
password
localhost</pre></div>Yes the username appears twice.</li>
<li>Replace username and password with the details of the account you just created.</li>
<li>This file has to be chmod'ed 600 (-rw------) or sendmail won't read it.</li>
<li>Look for the line beginning <b>O AuthOptions=</b> If this line is commented out with a leading <b>#</b>, remove the <b>#</b> and it should be <b>O AuthOptions=A</b></li>
</ul>
<h1><i><b>Ta-da!</b></i></h1> Now you're ready to run the tests in Step3, all of the mail should be accepted, the most likely rejection will be the final one.
</div>
<p>Thats it, good luck and happy mailing :)<br />Danny Angus</p>
</div>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">Copyright &#169; 2006-2012
<a href="http://www.apache.org">The Apache Software Foundation</a>.
All Rights Reserved.
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>