0

I am trying to send an email via my personal "Gmail" account to other "Gmail" account using Fedora 23. The idea is to send an Email ( for server alarms ) via Postfix, but I don't have corporate / personal domain. I am using this Postfix configuration:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 185.12.5.172
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/README_FILES
relayhost = [smtp.gmail.com]:587
sample_directory = /usr/share/doc/postfix/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
shlib_directory = /usr/lib64/postfix
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_use_tls = yes
unknown_local_recipient_reject_code = 550

Also I make a file with name - "sasl_password" :

[smtp.gmail.com]:587    name@gmail.com:password

But Postfix is unable to send it because of these errors in "/var/log/maillog":

Nov 29 19:35:37 domain postfix/qmgr[4911]: 4A7B318739D4: from=<>, size=2577, nrcpt=1 (queue active)
Nov 29 19:35:37 domain postfix/smtp[6080]: cannot load Certification Authority data, CAfile="/etc/ssl/certs/ca-certificates.crt": disabling TLS support
Nov 29 19:35:37 domain postfix/smtp[6080]: warning: TLS library problem: error:02001002:system library:fopen:No such file or directory:bss_file.c:168:fopen('/etc/ssl/certs/ca-certificates.crt','r'):
Nov 29 19:35:37 domain postfix/smtp[6080]: warning: TLS library problem: error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:171:
Nov 29 19:35:37 domain postfix/smtp[6080]: warning: TLS library problem: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:by_file.c:258:
Nov 29 19:35:37 domain postfix/smtp[6080]: 4A7B318739D4: TLS is required, but our TLS engine is unavailable
Nov 29 19:35:38 domain postfix/smtp[6080]: 4A7B318739D4: TLS is required, but our TLS engine is unavailable
Nov 29 19:35:38 domain postfix/smtp[6080]: connect to smtp.gmail.com[2a00:1450:4010:c09::6d]:587: Network is unreachable
Nov 29 19:35:38 domain postfix/smtp[6080]: 4A7B318739D4: to=<linuxuser@domain>, relay=none, delay=1801, delays=1800/0.03/0.34/0, dsn=4.4.1, status=deferred (connect to smtp.gmail.com[2a00:1450:4010:c09::6d]:587: Network is unreachable)
Nov 29 19:38:44 domain postfix/smtpd[6162]: connect from localhost[::1]
Nov 29 19:39:19 domain postfix/smtpd[6162]: NOQUEUE: reject: RCPT from localhost[::1]: 550 5.1.1 <destination@gmail.com>: Recipient address rejected: User unknown in local recipient table; from=<source@gmail.com> to=<destination@gmail.com> proto=ESMTP helo=<localhost>
Nov 29 19:39:31 domain postfix/smtpd[6162]: disconnect from localhost[::1] ehlo=1 mail=1 rcpt=0/1 quit=1 commands=3/4
Nov 29 19:39:33 domain postfix/smtpd[6162]: connect from localhost[::1]
Nov 29 19:40:04 domain postfix/smtpd[6162]: NOQUEUE: reject: RCPT from localhost[::1]: 550 5.1.1 <destination@gmail.com>: Recipient address rejected: User unknown in local recipient table; from=<root@localhost> to=<destination@gmail.com> proto=ESMTP helo=<localhost>
Nov 29 19:41:50 domain postfix/smtpd[6162]: disconnect from localhost[::1] ehlo=1 mail=1 rcpt=0/1 quit=1 commands=3/4
Nov 29 19:45:10 domain postfix/anvil[6164]: statistics: max connection rate 2/60s for (smtp:::1) at Nov 29 19:39:33
Nov 29 19:45:10 domain postfix/anvil[6164]: statistics: max connection count 1 for (smtp:::1) at Nov 29 19:38:44
Nov 29 19:45:10 domain postfix/anvil[6164]: statistics: max cache size 1 at Nov 29 19:38:44

EDIT 1:

After editing the SSL certifications and setup my Google account for less secure, I successfully fixed the problem. I used this tutorial:

https://community.runabove.com/kb/en/instances/how-to-relay-postfix-mails-via-smtp.gmail.com-on-ubuntu-14.04.html

ValeriRangelov
  • 119
  • 2
  • 10
  • I can only guess what is the actual question. Did you read your posted maillog? The answer(s) is/are clearly indicated - a connection (routing) problem. Besides that check your certificate files. – sam_pan_mariusz Nov 29 '15 at 19:32

1 Answers1

3

To begin with, you have forced TLS, but your TLS configuration is not valid. Either correct your TLS configuration or turn off TLS.

Next, your server cannot contact gmail. That is probably because it is trying to use IPv6. If you do not have an IPv6 connection, turn off IPv6 either in the OS or in postfix (in main.cf change inet_protocols from all to ipv4)

Third, your server seems to think it is authoritative for gmail, but I don't see why.

Law29
  • 3,557
  • 1
  • 16
  • 28
  • I have missed that about IPv4. Now the error which appears is: `Nov 29 20:40:53 domain postfix/smtpd[7272]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 550 5.1.1 : Recipient address rejected: User unknown in local recipient table; from= to= proto=ESMTP helo= Nov 29 20:40:53 domain sendmail[7271]: tATJergG007271: to=destination@gmail.com, ctladdr=linuxuser (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30215, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown` – ValeriRangelov Nov 29 '15 at 19:48
  • To start with, adding 127.0.0.1 to mynetworks (or even setting mynetworks to 127.0.0.1 only) might help a little, but my crystal ball tells me that your myhostname is gmail.com, and that cannot work. – Law29 Nov 29 '15 at 22:30
  • Of course, if you change myhostname from gmail.com, your sending address will probably become invalid, as I assume that you do not have your own domain. You would use myorigin, but setting myorigin to gmail.com would probably cause problems with real gmail.com addresses. What are you trying to do, exactly? – Law29 Nov 29 '15 at 22:40
  • I edit my question. And yes, you are right. I don't have my own domain. I am trying to send an email via Gmail. I want to use it for alarms, for example if there isn't ping to some IP, postfix can send me an email. – ValeriRangelov Nov 30 '15 at 02:14
  • OK so if I helped you to solve your problem, please "accept" the answer – Law29 Nov 30 '15 at 22:08