-1

I am running Debian 8 on GCP VM. Trying to send e-mails with postfix using Sendgrid SMTP service, but I am getting bounce and none of the e-mails are getting delivered.

I followed documentaion and instructions, but not sure where the issue is ...

I tried using apikey approach as well as username/password, but both didn't work.

Documentation: https://cloud.google.com/compute/docs/tutorials/sending-mail/using-sendgrid

Syslog message below

May  4 23:30:20 elegant-dxlhoa-logintry-vm systemd[1]: Stopping System Logging Service...
May  4 23:30:20 elegant-dxlhoa-logintry-vm systemd[1]: Starting System Logging Service...
May  4 23:30:20 elegant-dxlhoa-logintry-vm systemd[1]: Started System Logging Service.
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/pickup[4953]: 9F834A0CF7: uid=0 from=<root@elegant-dxlhoa-logintry-vm.c.elegant-dxl-dream.internal>
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/cleanup[4976]: 9F834A0CF7: message-id=<20180504233031.9F834A0CF7@dxlhoa-vm.c.dxl-dream.internal>
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/qmgr[4954]: 9F834A0CF7: from=<root@elegant-dxlhoa-logintry-vm.c.elegant-dxl-dream.internal>, size=428, nrcpt=1 (queue active)
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/error[4978]: 9F834A0CF7: to=<ctg.cloudtechguy@gmail.com>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced ([smtp.sendgrid.net]:2525)
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/cleanup[4976]: A1BA6A0D0A: message-id=<20180504233031.A1BA6A0D0A@dxlhoa-vm.c.dxl-dream.internal>
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/bounce[4980]: 9F834A0CF7: sender non-delivery notification: A1BA6A0D0A
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/qmgr[4954]: 9F834A0CF7: removed
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/qmgr[4954]: A1BA6A0D0A: from=<>, size=2434, nrcpt=1 (queue active)
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/error[4978]: A1BA6A0D0A: to=<root@elegant-dxlhoa-logintry-vm.c.elegant-dxl-dream.internal>, relay=none, delay=0.02, delays=0/0/0/0.02, dsn=5.0.0, status=bounced ([smtp.sendgrid.net]:2525)
May  4 23:30:31 elegant-dxlhoa-logintry-vm postfix/qmgr[4954]: A1BA6A0D0A: removed
?Starting                                                                                              289,56        Bot

Main.cf configuration below

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = dxlhoa-vm.c.dxl-dream.internal
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = dxlhoa-vm.c.dxl-dream.internal, localhost.c.dxl-dream.internal, , localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
relayhost = [smtp.sendgrid.net]:2525
mtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
default_transport = error
relay_transport = error
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
header_size_limit = 4096000
smtp_sasl_security_options = noanonymous
bounce_template_file = /etc/postfix/bounce.cf

Appreciate if anyone can help,

thanks TP

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
tpcool
  • 1
  • 1

1 Answers1

0

As described in this article you can run following command to make sure there is connectivity to SendGrid's SMTP relay.

telnet smtp.sendgrid.net 2525

Also, visit this documentation for some tips on Postfix configuration for SendGrid on Linux machines.

Milad Tabrizi
  • 480
  • 3
  • 15