# send-mail: Cannot open mail:25

## bfdi533

I have a laptop that has not otherwise installed mail server so I have ssmtp by default.

I have tried to send mail locally to other users on this box and cron is setup to mail me various reports on a regular basis but I keep getting this error when trying to send mail:

```
send-mail: Cannot open mail:25
```

Further checking into /etc/ssmtp/ssmtp.conf shows the following relevant lines:

```
# The place where the mail goes. The actual machine name is required

# no MX records are consulted. Commonly mailhosts are named mail.domain.com

# The example will fit if you are in domain.com and your mailhub is so named.

mailhub=mail

# Gentoo bug #47562

# Commenting the following line will force ssmtp to figure

# out the hostname itself.

#hostname=_HOSTNAME_
```

So, I am thinking that I need to uncomment out the hostname line but what is the mailhub supposed to be set to?  Obviously I do not have mail.domain.com as my mailserver when I am only trying to send local email.

Do I need to actually go through the time and effort to install something like postfix to get local mail to work?  I thought that the point of ssmtp was to have local mail deliverable for root and cron and sug without having to configure a real mailserver since so many basic system tools require the ability to send mail locally to root.

----------

## papal_authority

Just put your hostname there. Typing hostname on the command line should tell you what it is. I use ssmtp on several boxes I admin.

----------

## bfdi533

Not a bad thought.  I have set the hostname to my computer name.

However, the ssmtp service is trying to connect to a server called mail to send the mail.  Here is an excerpt from the /var/log/messages file:

```
Feb 10 15:53:47 davisone-n2g sSMTP[6444]: Unable to connect to "mail" port 25.

Feb 10 15:53:47 davisone-n2g sSMTP[6444]: Cannot open mail:25

```

Any ideas on what to set the mailhub to in order to make local mail delivery work?

----------

## magic919

ssmtp needs to connect to an MTA - it's what is does.

----------

## bfdi533

 *magic919 wrote:*   

> ssmtp needs to connect to an MTA - it's what is does.

 

Yes, that makes sense.  However, I need to be able to send local mail as well.  This is the mail package that is installed by default AFAIK.  

That said, how do I get ssmtp to deliver local mail (e.g. user@localhost, or just user)?  I need to be receiving local log, cron, etc. messages and I am not at this point.

Do I need to install something like postfix (which seems like overkill just to get local mail)?  Or some other MTA?

----------

## magic919

Ssmtp will not do any local delivery.

I can understand you wouldn't think you'd need an MTA, but you do from where I'm sitting.

Emerge Postfix, minor bit of config and job's done.

----------

## bfdi533

OK, me thinks that gentoo should install out of the box with a working MTA so that system logs and notifications can be delivered properly.

That said, I have now installed postfix and am already somewhat familiar with it so I changed a couple of things to only allow local delivery.  Specifically I changed the following:

```

inet_interfaces = localhost

mynetworks_style = host

```

Now, I get the following error when I try to send any mail:

```

postdrop: warning: unable to look up public/pickup: No such file or directory

```

Thoughts?  Solutions?

----------

## magic919

Generally if there is an error when you try to send mail then there is a problem flagged up as Postfix starts.  Can you restart Postfix and look at the logs.  You may only have to run newaliases, perhaps.

----------

