En un servidor que ejecuto ambos imágenes de docker y un servidor SMTP de postfix. El servidor smtp es accesible a través de localhost y es ni instalado en cualquier tipo de contenedor.
El problema es que puedo enviar correos electrónicos a través de la terminal usando sendemail fuera de cualquier contenedor, pero no puedo enviar correos electrónicos a través de la terminal que ejecuta sendemail dentro de ningún contenedor.
La configuración de postfix es la siguiente:
# 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/mailnamesmtpd_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 = 4hreadme_directory = no# TLS parameterssmtpd_tls_cert_file=/etc/letsencrypt/live/ellak.org/fullchain.pemsmtpd_tls_key_file= /etc/letsencrypt/live/ellak.org/privkey.pemsmtpd_use_tls=yessmtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scachesmtp_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_destinationmyhostname = guest8.ellak.gralias_maps = hash:/etc/aliasesalias_database = hash:/etc/aliasesmyorigin = /etc/mailnamemydestination = mail.ellak.org, guest8.ellak.gr, localhost.ellak.gr, localhost#Virtual alias domainsvirtual_alias_domains = ellak.org# RELAY Optionsrelayhost = [mail1.ellak.gr]:587smtp_sasl_auth_enable = yessmtp_sasl_security_options = noanonymoussmtp_sasl_password_maps = hash:/etc/postfix/sasl_passwdsmtp_use_tls = yessmtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crtlocal_recipient_maps = proxy:unix:passwd.byname $alias_mapssmtp_tls_note_starttls_offer = yes#Network Access Optionsmynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.17.0.0/16mailbox_size_limit = 0recipient_delimiter = +inet_interfaces = allrelay_domains = *
Dentro del contenedor corro:
sendemail -s 172.17.0.1:25 -f no-reply@ellak.org -t katanophoros@gmail.com -u Hello -m Hello
Y genera el siguiente error:
Nov 27 19:51:14 7e56b4e22e09 sendemail[1988]: WARNING => The recipient <katanophoros@gmail.com> was rejected by the mail server, error follows:Nov 27 19:51:14 7e56b4e22e09 sendemail[1988]: WARNING => Received: 454 4.7.1 <katanophoros@gmail.com>: Relay access deniedNov 27 19:51:14 7e56b4e22e09 sendemail[1988]: ERROR => Exiting. No recipients were accepted for delivery by the mail server.
En los registros de postfix que obtengo están:
Nov 27 21:42:54 guest8 postfix/smtpd[14979]: NOQUEUE: reject: RCPT from unknown[172.18.0.5]: 454 4.7.1 <katanophoros@gmail.com>: Relay access denied; from=<no-reply@ellak.org> to=<katanophoros@gmail.com> proto=ESMTP helo=<7e56b4e22e09>Nov 27 21:42:54 guest8 postfix/smtpd[14979]: lost connection after RCPT from unknown[172.18.0.5]Nov 27 21:42:54 guest8 postfix/smtpd[14979]: disconnect from unknown[172.18.0.5]Nov 27 21:46:14 guest8 postfix/anvil[14982]: statistics: max connection rate 2/60s for (smtp:172.18.0.5) at Nov 27 21:42:54Nov 27 21:46:14 guest8 postfix/anvil[14982]: statistics: max connection count 1 for (smtp:172.18.0.5) at Nov 27 21:42:41Nov 27 21:46:14 guest8 postfix/anvil[14982]: statistics: max cache size 1 at Nov 27 21:42:41
¿Tiene algún tipo de idea de cómo enviaré correos electrónicos dentro de los contenedores docker?