Ubuntu 14.04 installare SendMail

programmazione & dintorni
Rispondi
admin
Site Admin
Messaggi: 205
Iscritto il: dom mar 20, 2016 9:24 pm

Ubuntu 14.04 installare SendMail

Messaggio da admin »

1) Install sendmail
Sendmail might already be installed, but just in case, enter this into the server terminal:
sudo apt-get install sendmail

2) Configure sendmail
Enter the following command into the terminal and type "Y" for each question it asks:
sudo sendmailconfig

3) Edit hosts file
Time to edit your server's hosts file, access it by entering the following command into the terminal:
sudo vim /etc/hosts
Add the following line to the top of the file and save it:
127.0.0.1 localhost localhost.localdomain your_domain_name_here.com
Comment out any duplicate lines that already existed.

4) Restart apache
Let's restart your server just for good measure.
sudo service apache2 restart

Configuring a smarthost for sendmail

To configure a smarthost (with authentication) for sendmail, you'll have to create a file called /etc/mail/auth/client-info and modify the file /etc/mail/sendmail.mc.
Configure authentication

Let's start with creating the file /etc/mail/auth/client-info. The content in of this file represents your login credentials for the smarthost. It should look like the example below:

AuthInfo:<smarthost> "U:<username>" "I:<account>" "P:<password>"

Where:

<smarthost> is the fully qualified domain name (fqdn) of your smarthost
<username> is the userid used to login at the smarthost (often your email address)
<account> is the account to be used for your smarthost (often your email address as well)
<password> is the password that belongs to your smarthost username


Next, you'll have to build the password hash database with this command:

sudo bash -c "cd /etc/mail/auth/ && makemap hash client-info < client-info"


Configure sendmail

Now you have prepared the authentication setup for the concerning smarthost, let's go on and configure sendmail to use this smarthost. To do so, please edit the file /etc/mail/sendmail.mc. Find the line starting with MAILER_DEFINITIONS in this file and insert the lines before this line:

define(`SMART_HOST', `smarthost')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo', `hash /etc/mail/auth/client-info')dnl

Where:

<smarthost> is the fully qualified domain name (fqdn) of your smarthost


Now use the M4 macro processor to translate the /etc/mail/sendmail.mc file into a format sendmail understands (/etc/mail/sendmail.cf). This can be taken out by:

sudo bash -c "cd /etc/mail/ && m4 sendmail.mc > sendmail.cf"
Rispondi