155 lines
6.7 KiB
HTML
155 lines
6.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>Setup relayhost</title>
|
|
<link rel="stylesheet" type="text/css" href="./css/markdown.css" />
|
|
</head>
|
|
<body>
|
|
|
|
<div id="navigation">
|
|
<a href="/index.html" target="_blank">
|
|
<img alt="iRedMail web site"
|
|
src="./images/logo-iredmail.png"
|
|
style="vertical-align: middle; height: 30px;"
|
|
/>
|
|
<span>iRedMail</span>
|
|
</a>
|
|
// <a href="./index.html">Document Index</a></div><h1 id="setup-relayhost">Setup relayhost</h1>
|
|
<div class="toc">
|
|
<ul>
|
|
<li><a href="#setup-relayhost">Setup relayhost</a><ul>
|
|
<li><a href="#global-relay-host">Global relay host</a></li>
|
|
<li><a href="#sender-dependent-relay-host">Sender dependent relay host</a><ul>
|
|
<li><a href="#manage-with-iredadmin-pro">Manage with iRedAdmin-Pro</a></li>
|
|
<li><a href="#manage-with-command-line-tools">Manage with command line tools</a><ul>
|
|
<li><a href="#mysql-mariadb-postgresql">MySQL, MariaDB, PostgreSQL</a></li>
|
|
<li><a href="#openldap">OpenLDAP</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#screenshot-of-iredadmin-pro">Screenshot of iRedAdmin-Pro</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#see-also">See Also</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<p>Relay host is a server which can accept your email and sent it out to the final
|
|
destination for you.</p>
|
|
<h2 id="global-relay-host">Global relay host</h2>
|
|
<p>To setup a global relay host in iRedMail, please append below settings in
|
|
Postfix config file <code>/etc/postfix/main.cf</code> (Linux/OpenBSD) or
|
|
<code>/usr/local/etc/postfix/main.cf</code> (FreeBSD):</p>
|
|
<pre><code class="cfg">relayhost = [relay_server]:25
|
|
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
|
|
smtp_sasl_auth_enable = yes
|
|
smtp_sasl_mechanism_filter = login
|
|
smtp_sasl_security_options = noanonymous
|
|
</code></pre>
|
|
|
|
<div class="admonition note">
|
|
<p class="admonition-title">Note</p>
|
|
<ul>
|
|
<li>You should relace <code>relay_server</code> above by the real server address. for
|
|
example, <code>relayhost = [37.61.54.158]:25</code>, <code>relayhost = [smtp.gmail.com]:25</code>.</li>
|
|
<li>For more possible values/formats, please check Postfix document:
|
|
<a href="http://www.postfix.org/transport.5.html">Postfix transport table format (transport)</a>.</li>
|
|
</ul>
|
|
</div>
|
|
<p>Then write the username and password in <code>/etc/postfix/sasl_password</code>:</p>
|
|
<pre><code class="cfg">relay.server user:password
|
|
</code></pre>
|
|
|
|
<p>Run <code>postmap</code> and restart Postfix service:</p>
|
|
<pre><code class="cmd">postmap hash:/etc/postfix/sasl_password
|
|
service postfix restart
|
|
</code></pre>
|
|
|
|
<h2 id="sender-dependent-relay-host">Sender dependent relay host</h2>
|
|
<div class="admonition attention">
|
|
<p class="admonition-title">Attention</p>
|
|
<p>Sender dependent relay host is available in iRedMail-0.9.5 or later releases.</p>
|
|
</div>
|
|
<div class="admonition note">
|
|
<p class="admonition-title">If your sender dependent relay host requires SMTP Authentication</p>
|
|
<p>If your sender dependent relay host requires SMTP Authentication, please
|
|
add one more Postfix parameter in <code>/etc/postfix/main.cf</code> (Linux/OpenBSD)
|
|
or <code>/usr/local/etc/postfix/main.cf</code> (FreeBSD):</p>
|
|
<p><code>smtp_sender_dependent_authentication = yes</code></p>
|
|
<p>Then add smtp username and password in file <code>/etc/password/sasl_password</code>
|
|
like below:</p>
|
|
<p><code>user@domain.com smtp_user:smtp_password</code></p>
|
|
<p>Don't forget to run <code>postmap hash:/etc/postfix/sasl_password</code> after
|
|
modified this file.</p>
|
|
</div>
|
|
<h3 id="manage-with-iredadmin-pro">Manage with iRedAdmin-Pro</h3>
|
|
<p>Since iRedAdmin-Pro-SQL-2.4.0 or iRedAdmin-Pro-LDAp-2.6.0, it's able to manage
|
|
per-domain or per-user sender dependent relay host in domain or user profile
|
|
page, under tab <code>Relay</code>. Screenshot attached.</p>
|
|
<h3 id="manage-with-command-line-tools">Manage with command line tools</h3>
|
|
<h4 id="mysql-mariadb-postgresql">MySQL, MariaDB, PostgreSQL</h4>
|
|
<p>For SQL backends, you can manage sender dependent relay host in SQL table
|
|
<code>mailbox.sender_relayhost</code>. We use MySQL for example below.</p>
|
|
<ul>
|
|
<li>Per-domain sender dependent relay host:</li>
|
|
</ul>
|
|
<pre><code>sql> USE vmail;
|
|
sql> INSERT INTO sender_relayhost (account, relayhost) VALUES ('@domain.com', '[mail.gmail.com]:25');
|
|
</code></pre>
|
|
|
|
<ul>
|
|
<li>Per-user sender dependent relay host:</li>
|
|
</ul>
|
|
<pre><code>sql> USE vmail;
|
|
sql> INSERT INTO sender_relayhost (account, relayhost) VALUES ('user@domain.com', '[mail.gmail.com]:25');
|
|
</code></pre>
|
|
|
|
<h4 id="openldap">OpenLDAP</h4>
|
|
<p>For OpenLDAP backend:</p>
|
|
<ul>
|
|
<li>per-domain sender dependent relay host is stored in attribute <code>senderRelayHost</code> of domain account.</li>
|
|
<li>per-user sender dependent relay host is stored in attribute <code>senderRelayHost</code> of user account.</li>
|
|
</ul>
|
|
<p>Sample LDIF data:</p>
|
|
<ul>
|
|
<li>Per-domain sender dependent relay host</li>
|
|
</ul>
|
|
<pre><code>dn: domainName=mydomain.com,o=domains,dc=example,dc=com
|
|
senderRelayHost: [mail.gmail.com]:25
|
|
...
|
|
</code></pre>
|
|
|
|
<ul>
|
|
<li>Per-user sender dependent relay host</li>
|
|
</ul>
|
|
<pre><code>dn: mail=user@mydomain.com,ou=Users,domainName=mydomain.com,o=domains,dc=example,dc=com
|
|
senderRelayHost: [mail.gmail.com]:25
|
|
...
|
|
</code></pre>
|
|
|
|
<h3 id="screenshot-of-iredadmin-pro">Screenshot of iRedAdmin-Pro</h3>
|
|
<ul>
|
|
<li>iRedAdmin-Pro: Per-domain relay setting:</li>
|
|
</ul>
|
|
<p><img alt="" src="../images/iredadmin/domain_profile_relay.png" /></p>
|
|
<ul>
|
|
<li>iRedAdmin-Pro: Per-user relay setting:</li>
|
|
</ul>
|
|
<p><img alt="" src="../images/iredadmin/user_profile_relay.png" /></p>
|
|
<h2 id="see-also">See Also</h2>
|
|
<ul>
|
|
<li><a href="https://sendgrid.com/docs/Integrate/Mail_Servers/postfix.html">Use SendGrid as relay server</a></li>
|
|
</ul><div class="footer">
|
|
<p style="text-align: center; color: grey;">All documents are available in <a href="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. You can <a href="https://bitbucket.org/zhb/iredmail-docs/get/tip.tar.bz2">download the latest version</a> for offline reading. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
|
|
</div>
|
|
<script type="text/javascript">
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-3293801-21', 'auto');
|
|
ga('send', 'pageview');
|
|
</script>
|
|
</body></html> |