Difference between revisions of "Emailing"

From wiki
Jump to: navigation, search
Line 27: Line 27:
 
  smtp_tls_CAfile = /etc/postfix/cacert.pem
 
  smtp_tls_CAfile = /etc/postfix/cacert.pem
  
 
+
Now for SASL. We need to create a file called  
Now for SASL. We need to create a fil called  
 
 
  sasl_passwd
 
  sasl_passwd
  

Revision as of 11:44, 16 March 2017

Introduction

This is mainly about emailing users when their jobs are finished.

Only an easy workable solution is presented and it relies on gmail servers and having a special gmail address.

On the frontend, first focus on the followinng file:

/etc/postfix/main.cf

Look for the relayhost parameter. We will set it as follows:

relayhost = [smtp.gmail.com]:587

This means that postfix will outsource most of the email subtasks to gmail's servers. Though this may sound easy, it also means one must comply with gmail rules which can be quite stringent (i.e. require more work in setting up) in terms of security. Something to get right is TLS and SASL.

For TLS, first of all let's get a good certificate. One that works is:

Equifax_Secure_CA.pem

Which may be found in

/etc/ssl/certs

We can copy it over into a new name to create

/etc/postfix/cacert.pem

Then we want to get the following lines into main.cf:

smtp_use_tls = yes 
smtp_tls_CAfile = /etc/postfix/cacert.pem

Now for SASL. We need to create a file called

sasl_passwd

put all the gmail user and password details. I.e.

[smtp.gmail.com]:587 <gmail_address> <password>

A hash of this must be generated. Postfix has its own hasher, so it can be done as follows:

postmap sasl_passwd

You should get a new file called

sasl_passwd.db

after this operation.

Now main.cf needs to be told about all of this , so the following shoudl be included.

smtp_sasl_auth_enable = yes 
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous

This should get you most of the way there.