Difference between revisions of "Enable Outgoing Emails"

From Amahi Wiki
Jump to: navigation, search
Line 10: Line 10:
 
  cd /etc/mail
 
  cd /etc/mail
 
  sed -ie "s/.*SMART_HOST.*/define(\`SMART_HOST', \`$SMTP_SERVER')dnl/" sendmail.mc
 
  sed -ie "s/.*SMART_HOST.*/define(\`SMART_HOST', \`$SMTP_SERVER')dnl/" sendmail.mc
m4 sendmail.mc > sendmail.cf
 
 
  make
 
  make
 
  service sendmail restart
 
  service sendmail restart
Line 17: Line 16:
 
Make sure to replace ''your_isp_smtp_server'' on the first line with the hostname or IP address of your ISP SMTP server.
 
Make sure to replace ''your_isp_smtp_server'' on the first line with the hostname or IP address of your ISP SMTP server.
  
If you need to provide a username and password to use the SMTP server, you'll need to do this too:
+
If you need to connect to the SMTP server using port 587 (TLS/STARTTLS), you'll need to do this too:
  
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
SMTP_SERVER=your_isp_smtp_server
 
USERNAME=your_smtp_username
 
PASSWORD=your_smtp_password
 
 
  cd /etc/mail
 
  cd /etc/mail
  echo "AuthInfo:$SMTP_SERVER \"U:$USERNAME\" \"P:$PASSWORD\" \"M:PLAIN\"" >> access
+
  sed -ie "s/\(.*SMART_HOST.*\)/\1\ndefine(\`RELAY_MAILER_ARGS', \`TCP \$h 587')dnl\ndefine(\`ESMTP_MAILER_ARGS', \`TCP \$h 587')dnl/" sendmail.mc
makemap hash access.db < access
 
 
  make
 
  make
 
  service sendmail restart
 
  service sendmail restart
 
</div>
 
</div>
  
<!--
+
If you need to provide a username and password to use the SMTP server, you'll need to do this too:
If you need to connect to the SMTP server using port 587 (TLS/STARTTLS), you'll need to do this too:
 
  
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
  cd /etc/pki/tls/certs
+
  SMTP_SERVER=your_isp_smtp_server
  make sendmail.pem
+
  USERNAME=your_smtp_username
 +
PASSWORD=your_smtp_password
 
  cd /etc/mail
 
  cd /etc/mail
  sed -ie "s/.*confCACERT_PATH.*/define(\`confCACERT_PATH', \`\/etc\/pki\/tls\/certs')dnl/" sendmail.mc
+
  chmod 640 access
  sed -ie "s/.*confCACERT.*/define(\`confCACERT', \`\/etc\/pki\/tls\/certs\/ca-bundle.crt')dnl/" sendmail.mc
+
echo "AuthInfo:$SMTP_SERVER \"U:$USERNAME\" \"P:$PASSWORD\" \"M:PLAIN\"" >> access
  sed -ie "s/.*confSERVER_CERT.*/define(\`confSERVER_CERT', \`\/etc\/pki\/tls\/certs\/sendmail.pem')dnl/" sendmail.mc
+
  makemap -r hash access.db < access
sed -ie "s/.*confSERVER_KEY.*/define(\`confSERVER_KEY', \`\/etc\/pki\/tls\/certs\/sendmail.pem')dnl/" sendmail.mc
+
  sed -ie "s/.*confAUTH_MECHANISMS.*/define(\`confAUTH_MECHANISMS', \`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl\nFEATURE(\`authinfo',\`hash \/etc\/mail\/access')dnl/" sendmail.mc
m4 sendmail.mc > sendmail.cf
 
 
  make
 
  make
 
  service sendmail restart
 
  service sendmail restart
 
</div>
 
</div>
-->
 

Revision as of 20:32, 11 July 2010

Here's how to enable outgoing emails on your Amahi server.

Note: Make sure to use copy-paste to execute those commands. In particular, they contain back-ticks as the starting string delimiter, which can be hard to find on a keyboard!

As root:

SMTP_SERVER=your_isp_smtp_server
yum -y install sendmail-cf m4
cd /etc/mail
sed -ie "s/.*SMART_HOST.*/define(\`SMART_HOST', \`$SMTP_SERVER')dnl/" sendmail.mc
make
service sendmail restart

Make sure to replace your_isp_smtp_server on the first line with the hostname or IP address of your ISP SMTP server.

If you need to connect to the SMTP server using port 587 (TLS/STARTTLS), you'll need to do this too:

cd /etc/mail
sed -ie "s/\(.*SMART_HOST.*\)/\1\ndefine(\`RELAY_MAILER_ARGS', \`TCP \$h 587')dnl\ndefine(\`ESMTP_MAILER_ARGS', \`TCP \$h 587')dnl/" sendmail.mc
make
service sendmail restart

If you need to provide a username and password to use the SMTP server, you'll need to do this too:

SMTP_SERVER=your_isp_smtp_server
USERNAME=your_smtp_username
PASSWORD=your_smtp_password
cd /etc/mail
chmod 640 access
echo "AuthInfo:$SMTP_SERVER \"U:$USERNAME\" \"P:$PASSWORD\" \"M:PLAIN\"" >> access
makemap -r hash access.db < access
sed -ie "s/.*confAUTH_MECHANISMS.*/define(\`confAUTH_MECHANISMS', \`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl\nFEATURE(\`authinfo',\`hash \/etc\/mail\/access')dnl/" sendmail.mc
make
service sendmail restart