# Configuring sendmail for local only

## doro1211

Hi, I just want to use sendmail so that the cron and other scripts can send me mail giving the status of various things they attempt to do.  I don't need/want any kind of internet email functionality at this time.

I have emerged sendmail and mailx.  I started sendmail (/etc/init.d/sendmail start).  When I type: mail root and send a test message, nothing happens.  No errors, but it doesn't ever get to my inbox.  (i.e. when I type "mail" I get "no mail for root"

Also, sendmail takes like 10 minutes to start.  Why is this?  Is it because it is doing things for non-local mail?  If so, how can I stop this?

Thanks.

----------

## Apreche

In the gento guides there is a guide on how to setup sendmail, postfix, qmail, etc.  If you read these directions they take you through the mail configuration process step by step.  I chose postfix because it is simpler than sendmail.  But anyway, the first part of the directions is to setup local mail.  Just stop as soon as it works and do not follow through with the rest of the process.  Then you will have local mail only.

I also reccomend postfix instead of sendmail, it is easier.

----------

## doro1211

These are both quite involved and much more than I want.

The sendmail one is horribly complicated and doesn't configure it for local mail first.

I tried the qmail one, followed the directions exactly, got no errors at all, but it still doesn't work. 

I just want to be able to send mail between users on this system, nothing more.  I'm looking for a fairly simple solution.

Also, the qmail one has this annoying characteristic that no mail can be sent to root for security reasons.  I would like a program that doesn't have this ridiculous restriction.

----------

## Apreche

 *doro1211 wrote:*   

> These are both quite involved and much more than I want.
> 
> The sendmail one is horribly complicated and doesn't configure it for local mail first.
> 
> I tried the qmail one, followed the directions exactly, got no errors at all, but it still doesn't work. 
> ...

 

Like I said, postfix. 

```
# emerge postfix

then edit the file /etc/postfix/main.cf like so

myhostname = $host.domain.name

mydomain = $domain.name

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain $mydomain

mynetworks = my.ip.net.work/24, 127.0.0.0/8

home_mailbox = .maildir/

local_destination_concurrency_limit = 2

default_destination_concurrency_limit = 10

now edit the file

/etc/mail/aliases

now do this

# /usr/bin/newaliases

# /etc/init.d/postfix start
```

I got these directions from http://www.gentoo.org/doc/en/virt-mail-howto.xml

that's about as easy as it gets.

----------

## doro1211

Ok, giving this a shot, will post back with how it works.

Thanks.

----------

## doro1211

What do I put for mydomain if I have no domain?

Is my.ip.net.work supposed to be the ip address of this computer?  What do I put if it varies (DHCP)?

----------

## Apreche

This is all explained in the comments of the main.cf file.

----------

## doro1211

 *Quote:*   

> # The mydomain parameter specifies the local internet domain name.
> 
> # The default is to use $myhostname minus the first component.
> 
> # $mydomain is used as a default value for many other configuration
> ...

 

This is all it shows for my.domain... so I have no idea what to put since I am not on a domain.

----------

## nbrown

Did you see this:  https://forums.gentoo.org/viewtopic.php?t=61606  ?

----------

## doro1211

No I didn't, but that looks like exactly what I was looking for... let me try that and get back to you.  Thanks!

----------

## doro1211

Unfortunately, still no luck.  I followed those instructions, but still get "No mail for root"

It says to change the hostname to "localhost" and the domain name to "localdomain"...

I think this may be the problem, since my hostname is something different, and I don't have a domainname.

However, I don't know how to deal with the domain name issue, since I have no domain name.

I found this with apropos: 

       hostname - show or set the system's host name

       domainname - show or set the system's NIS/YP domain name

       dnsdomainname - show the system's DNS domain name

       nisdomainname - show or set system's NIS/YP domain name

       ypdomainname - show or set the system's NIS/YP domain name

       nodename - show or set the system's DECnet node name

What is the difference between a domainname, a dnsdomainname, an nisdomainname, and a ypdomainname?

----------

## dsb

no luch here either with mailx

however, I've kinda got pine working locally

----------

## nbrown

I followed the howto exactly with the following exception and it worked perfectly.

Exception:

In main.cf I set:

```

myhostname = localhost

mydomain = myactualdomain

```

where myactualdomain is the domain name I registered at no-ip.org and that I set using /etc/dnsdomainname

Hope that helps.

-nbrown

----------

## doro1211

If you type "hostname" at a command prompt, does it return localhost or some other name?

Also, I have not registered any kind of DNS name for this computer, nor do I wish to, so I have no idea what to use for a domain name.

----------

## nbrown

hostname returns my hostname not localhost

and dnsdomainname returns the domain name I put in main.cf

Maybe you should put the result of dnsdomainname in your main.cf instead of mydomain.

BTW, I'm not an expert on this, I only set this up 3 days ago and haven't really used it much, but it seems to work just fine for local mail only.

-nbrown

----------

## doro1211

Ok, so maybe it should be localhost for the hostname.  Only problem is that I am still lost on the domainname as I have none.  If I type dnsdomainname or domainname, I get nothing.  It's not a computer that is registered in any way, it's just my home desktop pc.  I can't give it no domain name in the config file though.

----------

## Cintra

have you looked at ssmtp, logwatch and mailx..

----------

## pjp

Moved from Other Things Gentoo.

----------

