no se puede enviar correo automático a través del script bash en Ubuntu 12.04: conectarse a mx3.hotmail.com[65.55.37.72]:25: se agotó el tiempo de espera de la conexión

no se puede enviar correo automático a través del script bash en Ubuntu 12.04: conectarse a mx3.hotmail.com[65.55.37.72]:25: se agotó el tiempo de espera de la conexión

Primero, pido disculpas por mi inglés (soy francés).

Estoy usandoEscritorio Ubuntu 12.04. Todavía estoy aprendiendo Shell Scripts, por lo que es posible que haya cometido un error realmente simple en alguna parte.

Estoy intentando escribir un script de shell que me envíe un correo electrónico cuando se utilice el 80% del espacio en disco. (Este script se utilizará en un cron en un servidor distante alojado por una empresa privada)

Para hacer eso uso el comando sendmail de Postfix.

El problema es que ni siquiera puedo enviar un correo electrónico de prueba a mi dirección de hotmail usando una simple línea de comando.

Revisé /var/log/mail.log y esto es lo que obtengo (con solo un comando usado en la terminal):

Dec  2 16:52:18 user-Precision-T3600 postfix/qmgr[7076]: BD8CC1561B8E: from=<user@user-Precision-T3600>, size=317, nrcpt=1 (queue active)
Dec  2 16:52:18 user-Precision-T3600 postfix/qmgr[7076]: 77ED015620AC: from=<user@user-Precision-T3600>, size=443, nrcpt=3 (queue active)
Dec  2 16:52:18 user-Precision-T3600 postfix/qmgr[7076]: DCD541561FDF: from=<user@user-Precision-T3600>, size=443, nrcpt=3 (queue active)
Dec  2 16:52:18 user-Precision-T3600 postfix/qmgr[7076]: AEDC31561FD7: from=<user@user-Precision-T3600>, size=443, nrcpt=3 (queue active)
Dec  2 16:52:18 user-Precision-T3600 postfix/qmgr[7076]: 0C9C815620BC: from=<user@user-Precision-T3600>, size=290, nrcpt=1 (queue active)
Dec  2 16:52:18 user-Precision-T3600 postfix/qmgr[7076]: 3961C15620B6: from=<user@user-Precision-T3600>, size=443, nrcpt=3 (queue active)
Dec  2 16:52:18 user-Precision-T3600 postfix/qmgr[7076]: 6AC1F15620BD: from=<user@user-Precision-T3600>, size=443, nrcpt=3 (queue active)
Dec  2 16:52:48 user-Precision-T3600 postfix/smtp[7930]: connect to mx4.hotmail.com[65.55.37.88]:25: Connection timed out
Dec  2 16:52:48 user-Precision-T3600 postfix/smtp[7931]: connect to mx3.hotmail.com[65.55.37.88]:25: Connection timed out
Dec  2 16:52:48 user-Precision-T3600 postfix/smtp[7929]: connect to mx3.hotmail.com[65.55.37.120]:25: Connection timed out
Dec  2 16:52:48 user-Precision-T3600 postfix/smtp[7932]: connect to mx1.hotmail.com[65.55.92.136]:25: Connection timed out
Dec  2 16:52:48 user-Precision-T3600 postfix/smtp[7928]: connect to mx1.hotmail.com[65.54.188.126]:25: Connection timed out
Dec  2 16:53:18 user-Precision-T3600 postfix/smtp[7931]: connect to mx4.hotmail.com[65.55.37.104]:25: Connection timed out
Dec  2 16:53:18 user-Precision-T3600 postfix/smtp[7928]: connect to mx1.hotmail.com[65.54.188.110]:25: Connection timed out
Dec  2 16:53:18 user-Precision-T3600 postfix/smtp[7929]: connect to mx4.hotmail.com[65.55.92.152]:25: Connection timed out
Dec  2 16:53:18 user-Precision-T3600 postfix/smtp[7932]: connect to mx1.hotmail.com[65.54.188.72]:25: Connection timed out
Dec  2 16:53:18 user-Precision-T3600 postfix/smtp[7930]: connect to mx3.hotmail.com[65.55.92.184]:25: Connection timed out
Dec  2 16:53:48 user-Precision-T3600 postfix/smtp[7932]: connect to mx1.hotmail.com[65.55.92.168]:25: Connection timed out
Dec  2 16:53:48 user-Precision-T3600 postfix/smtp[7931]: connect to mx3.hotmail.com[65.55.37.72]:25: Connection timed out
Dec  2 16:53:48 user-Precision-T3600 postfix/smtp[7928]: connect to mx3.hotmail.com[65.55.92.184]:25: Connection timed out
Dec  2 16:53:48 user-Precision-T3600 postfix/smtp[7929]: connect to mx2.hotmail.com[65.55.37.104]:25: Connection timed out
Dec  2 16:53:48 user-Precision-T3600 postfix/smtp[7930]: connect to mx3.hotmail.com[65.55.92.168]:25: Connection timed out
Dec  2 16:54:18 user-Precision-T3600 postfix/smtp[7932]: connect to mx2.hotmail.com[65.55.92.136]:25: Connection timed out
Dec  2 16:54:18 user-Precision-T3600 postfix/smtp[7928]: connect to mx1.hotmail.com[65.55.37.88]:25: Connection timed out
Dec  2 16:54:18 user-Precision-T3600 postfix/smtp[7931]: connect to mx3.hotmail.com[65.55.92.184]:25: Connection timed out
Dec  2 16:54:18 user-Precision-T3600 postfix/smtp[7929]: connect to mx4.hotmail.com[65.55.37.104]:25: Connection timed out
Dec  2 16:54:18 user-Precision-T3600 postfix/smtp[7930]: connect to mx1.hotmail.com[65.55.37.72]:25: Connection timed out
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7931]: connect to mx4.hotmail.com[65.55.37.88]:25: Connection timed out
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7932]: connect to mx4.hotmail.com[65.55.37.104]:25: Connection timed out
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7928]: connect to mx1.hotmail.com[65.55.92.184]:25: Connection timed out
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7929]: connect to mx4.hotmail.com[65.55.37.120]:25: Connection timed out
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7930]: connect to mx3.hotmail.com[65.55.37.72]:25: Connection timed out
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7932]: 0C9C815620BC: to=<[email protected]>, relay=none, delay=1253, delays=1102/0.02/150/0, dsn=4.4.1, status=deferred (connect to mx4.hotmail.com[65.55.37.104]:25: Connection timed out)
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7928]: BD8CC1561B8E: to=<[email protected]>, relay=none, delay=23169, delays=23019/0.01/150/0, dsn=4.4.1, status=deferred (connect to mx1.hotmail.com[65.55.92.184]:25: Connection timed out)
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7930]: DCD541561FDF: to=<[email protected]>, relay=none, delay=18424, delays=18274/0.01/150/0, dsn=4.4.1, status=deferred (connect to mx3.hotmail.com[65.55.37.72]:25: Connection timed out)
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7931]: AEDC31561FD7: to=<[email protected]>, relay=none, delay=19135, delays=18985/0.02/150/0, dsn=4.4.1, status=deferred (connect to mx4.hotmail.com[65.55.37.88]:25: Connection timed out)
Dec  2 16:54:48 user-Precision-T3600 postfix/smtp[7929]: 77ED015620AC: to=<[email protected]>, relay=none, delay=9121, delays=8971/0.01/150/0, dsn=4.4.1, status=deferred (connect to mx4.hotmail.com[65.55.37.120]:25: Connection timed out)
Dec  2 16:54:48 user-Precision-T3600 postfix/error[7952]: 3961C15620B6: to=<[email protected]>, relay=none, delay=8585, delays=8435/150/0/0.05, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to mx3.hotmail.com[65.55.37.72]:25: Connection timed out)
Dec  2 16:54:48 user-Precision-T3600 postfix/error[7953]: 6AC1F15620BD: to=<[email protected]>, relay=none, delay=8296, delays=8146/150/0/0.06, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to mx3.hotmail.com[65.55.37.72]:25: Connection timed out)

aquí está mi línea de comando:

  $ echo foobar | sendmail -i [email protected]

Al principio pensé que era el puerto bloqueado por el firewall de Linux, lo verifiqué usando el comando:

$ sudo ufw status

esto es lo que obtengo:

État : actif

Vers                       Action      Depuis
----                       ------      ------
25                         ALLOW       Anywhere
25/tcp                     ALLOW       Anywhere
25                         ALLOW       Anywhere (v6)
25/tcp                     ALLOW       Anywhere (v6)

No sé qué es lo que no funciona, por favor ayuda, llevo varias horas en esto...

Aquí está el archivo de configuración postfix (main.cf):

# 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 (Ubuntu)
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.

myhostname = bmerlet-Precision-T3600
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = bmerlet-Precision-T3600, localhost.localdomain, , localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

No sé si tengo que cambiar algunos parámetros en ese archivo, y si es el caso, no sé cuál... :(

Gracias por la ayuda por adelantado ;)

ben

Respuesta1

Es muy posible que el puerto 25 esté bloqueado o no sea utilizado por Hotmail. puedes encontrar mejorreferencias, pero pruebe con puertos alternativos, como por ejemplo el puerto 465/587.

información relacionada