3

I am trying to send email from the command line from my ubuntu server. So I started configuring the postfix onto my local machine rather than on server. So basically these are steps which I followed:

sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules

sudo vim /etc/postfix/main.cf

Added below lines into the file:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

sudo vim /etc/postfix/sasl_passwd

Added this one line in the file [smtp.gmail.com]:587 USERNAME@gmail.com:PASSWORD

Permissions and updated the postfix config file.

sudo chmod 400 /etc/postfix/sasl_passwd

sudo postmap /etc/postfix/sasl_passwd

reload the POSTFIX : sudo /etc/init.d/postfix reload

Then on my terminal I run this command :

echo "Test mail from postfix" | mail -s "Test Postfix" you@example.com

But didn't receive the mail. So I checked the log file and that is where i found the below stack trace for it:

postfix/pickup[26530]: A62AF2E29B4: uid=1000 from=<z@mylaptop>
postfix/cleanup[27372]: A62AF2E29B4: message-id=<20160428114754.A62AF2E29B4@mylaptop>
postfix/qmgr[26529]: A62AF2E29B4: from=<z@mylaptop>, size=365, nrcpt=1 (queue active)
postfix/smtp[27379]: cannot load Certificate Authority data: disabling TLS support
postfix/smtp[27379]: warning: TLS library problem: error:02001002:system library:fopen:No such file or directory:bss_file.c:169:fopen('/etc/postfix/cacert.pem','r'):
postfix/smtp[27379]: warning: TLS library problem: error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:172:
postfix/smtp[27379]: warning: TLS library problem: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:by_file.c:274:
postfix/smtp[27379]: connect to smtp.gmail.com[2404:6800:4003:c02::6d]:587: Network is unreachable
postfix/smtp[27379]: A62AF2E29B4: to=<xyz@gmail.com>, relay=smtp.gmail.com[74.125.68.108]:587, delay=1.4, delays=0.01/0.02/1/0.34, dsn=5.7.0, status=bounced (host smtp.gmail.com[74.125.68.108] said: 530  5.7.0 Must issue a STARTTLS command first. g70sm14489231pfb.7 - gsmtp (in reply to MAIL FROM command))
postfix/cleanup[27372]: 5BFDF2E2B48: message-id=<20160428114756.5BFDF2E2B48@mylaptop>
postfix/bounce[27383]: A62AF2E29B4: sender non-delivery notification: 5BFDF2E2B48
postfix/qmgr[26529]: 5BFDF2E2B48: from=<>, size=2239, nrcpt=1 (queue active)
postfix/qmgr[26529]: A62AF2E29B4: removed
postfix/local[27384]: 5BFDF2E2B48: to=<z@mylaptop>, relay=local, delay=0.01, delays=0/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
postfix/qmgr[26529]: 5BFDF2E2B48: removed
Akshay Shah
  • 131
  • 1
  • 3
  • 1
    The problem is here - ```No such file or directory:bss_file.c:169:fopen('/etc/postfix/cacert.pem','r')``` – ALex_hha Apr 29 '16 at 12:52

1 Answers1

0
postfix/smtp[27379]: cannot load Certificate Authority data: disabling TLS support  
postfix/smtp[27379]: warning: TLS library problem: error:02001002:system library:fopen:No such file or directory:bss_file.c:169:fopen('/etc/postfix/cacert.pem','r'):   

Install certificates of Certification Authorities - they certify other certificates => install package named ca-certificates on debian/ubuntu.

Related question: https://serverfault.com/a/497897/163277

AnFi
  • 5,883
  • 1
  • 12
  • 26