2

First, I apologize for my English (i'm french).

I'm using Ubuntu desktop 12.04. I'm still learning Shell Scripts so I may have made a really simple mistake somewhere.

I'm trying to write a shell script that sends me an email when 80% of the disk space is used. (This script will be used in a cron on a distant server hosted by a private company)

To do that I use the Postfix sendmail command.

The problem is that I can't even send a test email to my hotmail address using a simple command line.

I checked the /var/log/mail.log and this is what I get (with only one command used in the 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)

here is my command line:

  $ echo foobar | sendmail -i [email protected]

At first I thought it was the port that was blocked by the linux firewall, I checked by using the command :

$ sudo ufw status

here's what I get:

État : actif

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

I don't know what isn't working please help, I’ve been on this for several hours now...

Here is postfix config file (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

I don't know if I have to change some parameters in that file, and if it is the case, I do not know which one... :(

Thanks for the help in advance ;)

Ben

2
  • Can you reach the mail hosts using e.g. telnet mx4.hotmail.com 25? Dec 3, 2013 at 13:39
  • Tried to reach the host using your command line, here is what I got: $ telnet mx4.hotmail.com 25 Trying 65.54.188.94... Trying 65.54.188.72... Trying 65.54.188.110... Trying 65.55.37.72... Trying 65.55.92.168... Trying 65.55.92.184... Trying 65.55.37.88... Trying 65.55.37.120... Trying 65.55.37.104... Trying 65.55.92.136... Trying 65.55.92.152... Trying 65.54.188.126... telnet: Unable to connect to remote host: Connection timed out
    – Ben
    Dec 4, 2013 at 10:30

1 Answer 1

0

It's quite possible that port 25 is blocked or not used by hotmail. You can find better references, but try alternate ports, like e.g., port 465/587.

2
  • It seems you are right, hotmail blocks the port 25. I tried using another email address on port 25 and it worked just fine. thanks
    – Ben
    Dec 9, 2013 at 15:57
  • Some ISP's block port 25 so packets never get to the server.
    – rickhg12hs
    Dec 10, 2013 at 3:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .