# Cannot send email thru mutt - Cannot open localhost:25



## b3n10 (May 10, 2020)

I'm trying to learn mail servers and setting them up on 3 different OSes: Ubuntu, CentOS, FreeBSD. I've installed postfix, dovecot and mutt and all these OSes  are running locally on my laptop via VirtualBox. No problems with Ubuntu & CentOS. But with FreeBSD I'm getting error when sending email using mutt:


```
SSL_connect: No error: 0
sendmail: Cannot open localhost:25
```

in /var/log/maillog:

```
sSMTP[941]: Creating SSL connection to host
postfix/smtpd[942]: connect from localhost[127.0.0.1]
sSMTP[941]: Cannot open localhost:25
postfix/smtpd[942]: lost connection after UNKNOWN from localhost[127.0.0.1]
postfix/smtpd[942]: disconnect from localhost[127.0.0.1] unknown=0/1 commands=0/1
```

Here is my ssmtp.conf:

```
root=postmaster
mailhub=localhost:25
rewriteDomain=localhost
hostname=localhost
UseTLS=YES
Debug=YES
```

The default setup is using 'mail':

```
mailhub=mail
```

But error shows in /var/log/maillog:

```
Unable to locate mail
Cannot open mail:25
```

I have no problems sending thru telnet:


```
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost ESMTP Postfix
EHLO localhost
250-localhost
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250-SMTPUTF8
250 CHUNKING
mail from: batman@localhost
250 2.1.0 Ok
rcpt to: robin@localhost
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: hi
test
.
250 2.0.0 Ok: queued as D992F9D546
quit
221 2.0.0 Bye
Connection closed by foreign host.
```

/var/log/maillog:

```
postfix/smtpd[903]: connect from localhost[127.0.0.1]
postfix/smtpd[903]: D992F9D546: client=localhost[127.0.0.1]
postfix/cleanup[909]: D992F9D546: message-id=<20200510045025.D992F9D546@localhost>
postfix/qmgr[748]: D992F9D546: from=<batman@localhost>, size=304, nrcpt=1 (queue active)
dovecot[911]: lda(robin)<911><+CPIJB6It16PAwAAjUYr8g>: msgid=<20200510045025.D992F9D546@localhost>: saved mail to INBOX
postfix/local[910]: D992F9D546: to=<robin@localhost>, relay=local, delay=26, delays=26/0.01/0/0.04, dsn=2.0.0, status=sent (delivered to command: /usr/local/libexec/dovecot/deliver)
postfix/qmgr[748]: D992F9D546: removed
postfix/smtpd[903]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
```

And user 'robin' receives the message.

```
From: batman@localhost
Subject: hi
test
```


----------

