Difference between revisions of "Use gmail as smtp server"

From BubbaWiki
Jump to navigation Jump to search
(Created page with ' Contributed by Albert Pauw (Work in progress) cd /etc/postfix cp main.cf main.cf.org (just to be sure, we save a copy). Now we edit the file main.cf: The following lines nee...')
 
m
Line 1: Line 1:
Contributed by Albert Pauw ('''Work in progress''')


Contributed by Albert Pauw (Work in progress)
Just to be sure, we save a copy:


cd /etc/postfix
cd /etc/postfix cp main.cf main.cf.org
cp main.cf main.cf.org


(just to be sure, we save a copy).
Now we edit the file main.cf:


Now we edit the file main.cf:
The following lines need to be changed:  


The following lines need to be changed:
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128


mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
change to  
change to -> mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
192.168.1.0/24


Obviously you add your internal network, 192.168.1.0 is a good guess
'''mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24'''
(192.168.0.0 is another much used one). If you don't do this, then your
bubba won't accept mail for relaying.


relayhost =
Obviously you add your internal network, 192.168.1.0 is a good guess (192.168.0.0 is another much used one).  
change to -> relayhost = [smtp.gmail.com]:587


Add the following lines:
If you don't do this, then your bubba won't accept mail for relaying.


smtp_tls_CAfile=/etc/ssl/certs/ca-certificates.crt
relayhost =
smtp_use_tls=yes
smtpd_sasl_local_domain = $myhostname
smtp_sasl_tls_security_options = noanonymous
smtpd_sasl_application_name = smtpd


Now create or edit the file sasl_passwd and add the following line with
change to
your gmail account data:


[smtp.gmail.com]:587 <Your Gmail address>:<Your Gmail password>
'''relayhost = [smtp.gmail.com]:587'''


save it and run
Add the following lines:


postmap sasl_passwd
'''smtp_tls_CAfile=/etc/ssl/certs/ca-certificates.crt'''
'''smtp_use_tls=yes'''
'''smtpd_sasl_local_domain = $myhostname'''
'''smtp_sasl_tls_security_options = noanonymous'''
'''smtpd_sasl_application_name = smtpd'''


To (re)generate the sasl_passwd.db file
Now create or edit the file sasl_passwd and add the following line with your gmail account data:


Now restart postfix
[smtp.gmail.com]:587 Your_Gmail_ address:Your_Gmail_password


/etc/init.d/postfix restart
save it and run


Look at /var/log/mail.log
postmap sasl_passwd


tail -f /var/log/mail.log
to (re)generate the sasl_passwd.db file.
 
Now restart postfix
 
/etc/init.d/postfix restart
 
Look at /var/log/mail.log
 
tail -f /var/log/mail.log  


and send an email using your bubba (b3) as smtp server.
and send an email using your bubba (b3) as smtp server.

Revision as of 11:43, 24 March 2011

Contributed by Albert Pauw (Work in progress)

Just to be sure, we save a copy:

cd /etc/postfix cp main.cf main.cf.org

Now we edit the file main.cf:

The following lines need to be changed:

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

change to

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24

Obviously you add your internal network, 192.168.1.0 is a good guess (192.168.0.0 is another much used one).

If you don't do this, then your bubba won't accept mail for relaying.

relayhost =

change to

relayhost = [smtp.gmail.com]:587 

Add the following lines:

smtp_tls_CAfile=/etc/ssl/certs/ca-certificates.crt
smtp_use_tls=yes
smtpd_sasl_local_domain = $myhostname
smtp_sasl_tls_security_options = noanonymous
smtpd_sasl_application_name = smtpd

Now create or edit the file sasl_passwd and add the following line with your gmail account data:

[smtp.gmail.com]:587 Your_Gmail_ address:Your_Gmail_password 

save it and run

postmap sasl_passwd 

to (re)generate the sasl_passwd.db file.

Now restart postfix

/etc/init.d/postfix restart 

Look at /var/log/mail.log

tail -f /var/log/mail.log 

and send an email using your bubba (b3) as smtp server.