Difference between revisions of "Enable Outgoing Emails"

From Amahi Wiki
Jump to: navigation, search
m
Line 4: Line 4:
  
 
[[Open Terminal as root|As root]]:
 
[[Open Terminal as root|As root]]:
 
+
{{Code|SMTP_SERVER=your_isp_smtp_server
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
+
yum -y install sendmail-cf m4
SMTP_SERVER=your_isp_smtp_server
+
cd /etc/mail
yum -y install sendmail-cf m4
+
sed -ie "s/.*SMART_HOST.*/define(\`SMART_HOST', \`$SMTP_SERVER')dnl/" sendmail.mc
cd /etc/mail
+
make
sed -ie "s/.*SMART_HOST.*/define(\`SMART_HOST', \`$SMTP_SERVER')dnl/" sendmail.mc
+
service sendmail restart}}
make
 
service sendmail restart
 
</div>
 
  
 
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.
Line 18: Line 15:
 
If you need to connect to the SMTP server using port 587 (TLS/STARTTLS), 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;">
+
{{Code|cd /etc/mail
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
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
make
+
service sendmail restart}}
service sendmail restart
+
 
</div>
 
 
If you want to use another port than 587, change that number in the above command (it's there twice), before executing it. If you already executed it, edit the sendmail.mc file, and search for 587 - it should appear there twice - change both.
 
If you want to use another port than 587, change that number in the above command (it's there twice), before executing it. If you already executed it, edit the sendmail.mc file, and search for 587 - it should appear there twice - change both.
  
 
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 provide a username and password to use the SMTP server, you'll need to do this too:
 
+
{{Code|SMTP_SERVER=your_isp_smtp_server
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
+
USERNAME=your_smtp_username
SMTP_SERVER=your_isp_smtp_server
+
PASSWORD=your_smtp_password
USERNAME=your_smtp_username
+
cd /etc/mail
PASSWORD=your_smtp_password
+
chmod 600 access
cd /etc/mail
+
echo "AuthInfo:$SMTP_SERVER \"U:$USERNAME\" \"P:$PASSWORD\" \"M:PLAIN\"" >> access
chmod 600 access
+
makemap -r hash access.db < access
echo "AuthInfo:$SMTP_SERVER \"U:$USERNAME\" \"P:$PASSWORD\" \"M:PLAIN\"" >> 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
makemap -r hash access.db < access
+
make
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
+
service sendmail restart}}
make
 
service sendmail restart
 
</div>
 

Revision as of 01:31, 26 January 2011

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:

bash code
{{{1}}}


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:

bash code
​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 want to use another port than 587, change that number in the above command (it's there twice), before executing it. If you already executed it, edit the sendmail.mc file, and search for 587 - it should appear there twice - change both.

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

bash code
{{{1}}}