4

A line in my cron.daily script not work as expected. I haven't any special smtp mail server in system, this line rsync -avun --inplace /oneuser/file.xls /otheruser/file.xls| mail -s "$0 $?" provide Cannot open mail:25 message What Do i need to setup a local mail subsystem? I preffer simple mailboxes to email server setup. I like that otheruser logged in could read cron (root) messages by mail command. I found a similar question but not the answer here How to set up local mail retrieval and delivery?

when i try to send a mail to user with mail command i get after dot

EOT
[root@localhost etc]# send-mail: Cannot open mail:25
Yurij73
  • 1,992
  • SOLVED after http://www.alanpinnt.com/2011/08/31/postfix-etcaliases-db-missing-newaliases-not-working/ and http://www.postfix.org/BASIC_CONFIGURATION_README.html#syntax – Yurij73 Apr 21 '13 at 14:51

4 Answers4

7

I recommend you just install postfix for the local mail delivery. On Ubuntu at least it will interactively ask about your setup, which includes a local delivery only option.

In addition you can make a local account mailboy for mail delivery and allow all people to read the mail delivered to that account.

In order to get the mail to root delivered to mailboy, edit /etc/aliases and adda line:

root: mailboy@localhost

after doing so run newaliases.

Anthon
  • 79,293
  • @Yurij73 I am not so familiair with Fedora but I don't think you had a real sendmail installed. Try running it and it probably asks you which mta (message transfer agent) you want to have installed. If that is the case you probably should probably remove your comments (and I will remove mine) to make sure future readers don't get confused – Anthon Apr 21 '13 at 10:43
  • i have installed postfix, now postfix daemon is listening on 25 port and i get other sort message after mailx -s "test" - Temporary lookup failure instead of Cannot open mail:25. I should read postfix man further – Yurij73 Apr 21 '13 at 12:56
  • I defined a in /etc/postfix/main.cf $myhost as localhost.localdomain and $mydestination as localhost.localdomain but still unable to leave a smtp message rcpt to:root@localhost 451 4.3.0 <*>: Temporary lookup failure – Yurij73 Apr 21 '13 at 13:24
  • Finnaly, i solved problem. the wanted trick was to change from ssmtp
    • 1 /usr/sbin/sendmail.ssmtp
    • 2 /usr/sbin/sendmail.postfix

    with help of alternatives --config mta thanks for proposal about Postfix

    – Yurij73 Apr 21 '13 at 14:48
0

I also had this messages on log and is the ssmtp that seems to be the new default to send mail of Fedora 19+ or at least appears installed on my Fedora 19. If you have other mta running on port 25, ssmtp will give you this error. But I'm writing, more to say, that unsent messages go to a dead.letter file, on /root in my case, so if you wonder what happened to the email not delivered, that are in one file with name dead.letter.

Sérgio
  • 263
  • 2
  • 8
0

I'm on Fedora 20 and suddenly started to have this error on newly installed systems. All previous hosts (>70) just were able to so something like:

echo "Hello world" | mail -s "Salute" johndoe@somehost.com

so useful from scripts and so on.

Now command line invocations started to fail with

sSMTP[3144]: Unable to connect to "mail" port 25. sSMTP[3144]: Cannot open mail:25

The journal of sendmail hints of the command not liking the -bd option ("run as a daemon"). How so ? Of course, if not daemonized, it won't listen on 25/tcp causing the error.

Now, follow the command itself. Instead of running the original sendmail binary, ssmtp has come in the way and supplanted it.

/usr/sbin/sendmail -> /etc/alternatives/mta -> /usr/sbin/sendmail.ssmtp

instead of

/usr/sbin/sendmail -> /etc/alternatives/mta -> /usr/sbin/sendmail.sendmail

Now, ssmtp is as per its man page very simple, intended to replace sendmail in its easiest function - and won't support the -bd option. Thus, no port 25.

Here all breaks - command talking to port 25 will bail out.

I uninstalled (yum remove ssmtp) - and this caused the original sendmail to resume its role - starting the service again brings up port 25 to life.

Now mailing is back in order in the old way.

In another moment I'll take a look to any advantages of ssmtp...

0

What you need is an SMTP server, a Mail Transfer Agent.

You can simply install opensmtpd and start the service. The default configuration is to do local delivery of mail.

aude
  • 292