inbox whne realyed directly to the internet , so in this case we
relay mails through the gmail servers.
agnello.dsouza@gmail com --> this is the main account which we use as
username: password in /etc/postfix/sasl_passwd (smtp.gmai.com
agnello.dsouza@gmail.com:password)
We cannot use any "from address" unless mentioned in setting ==>
accounts ==> "send mail from other address" . we add the following in
the this field user1@example.com , user2@example.com ,
user3@example.com ( for enable each of these accounts gmail will send
a verification code to user1@example.com user2@example.com and
user3@example.com )
/etc/postfix/relayhost_map
@exapmle.com smtp.gmail.com
now we understood theory we now do the postfix full setting :
we Create /etc/postfix/sasl_ passwd with auth information like this
------------------------------------------------------------------------
@example.com agnello.dsouza@gmail.com:password
# for every other domain we use
smtp.gmail.com agnello.dsouza@gmail.com:password
------------------------------------------------------------------------
postmap /etc/postfix/sasl_ passwd
the /etc/postfix/relayhost_maps has all the domains with corresponding
ISP's it relays to .
------------------------------------------------------------------------------------
@example smtp.gmail.com:587
#we could have multiple other domains here which relay via vairous
other ISP's .
------------------------------------------------------------------------------------
postmap /etc/postfix/relayhost_maps
our transport file contains the following :
gmail.com smtp:[smtp.gmail.com]:587
postmap /etc/postfix/transport
# Download the Thawte root certificates from
# <https://www.verisign.com/support/roots.html> and setup
# a certificate for Postfix.
$ firefox https://www.verisign.com/support/roots.html
$ cd ~/Downloads
$ unzip -q roots.zip
$ sudo mkdir /etc/postfix/certs
$ sudo cp ~/Downloads/Thawte\ Root\ Certificates/Thawte\ Root\
Certificates/thawte\ Premium\ Server\ CA/Thawte\ Premium\ Server\
CA.pem /etc/postfix/certs
$ sudo c_rehash /etc/postfix/certs/
Doing /etc/postfix/certs/
Thawte Premium Server CA.pem => d44d72e8.0
# Add the following lines to `/etc/postfix/main.cf`:
mydomain = server1.com
myhostname = mail.server1.com
#relayhost = smtp.gmail.com:587
relayhost = smtp.gmail.com:587
# auth
smtpd_sasl_path = smtpd
smtp_sasl_type = cyrus
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
# tls
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_map
smtpd_sasl_auth_enable = no
smtp_tls_security_level = may
smtp_tls_CApath = /etc/postfix/cert
smtpd_sasl_local_domain = $myhostname
smtp_tls_session_cache_timeout = 3600s
smtp_tls_loglevel = 1
tls_random_source = dev:/dev/urandom
smtp_use_tls = yes
smtp_sasl_tls_security_options = noanonymous
smtp_tls_note_starttls_offer = yes
smtpd_tls_received_header = yes
smtpd_sasl_application_name = smtpd
transport_maps = hash:/etc/postfix/transport
postfix stop
postfix start
sources :
http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/
http://trentmick.blogspot.com/2009/11/using-gmail-for-outbound-email-on-mac.html
No comments:
Post a Comment