# Problem with Sendmail



## RedErick (Aug 29, 2013)

Hello! 

A few days ago I changed my hostname value from xxxxx.xxxx.com to xxxx.com (by editing in /etc/rc.conf and in /etc/dhclient.conf). Yesterday I have installed the lynis application to check my system.  And thatâ€™s all that I have done.

Now periodically I have next messages in my /var/log/all.log file:


```
Aug 29 00:23:38 gateway sm-mta[1666]: r7SIh8Nn088996: SYSERR(root): hash map "Alias0": unsafe map file /etc/mail/aliases.db: World writable directory

Aug 29 00:23:38 gateway sm-mta[1666]: r7S05Y9j041529: to=<root@xxxxx.xxxx.com>, delay=21:18:03, xdelay=00:00:00, mailer=esmtp, pri=3997777, relay=xxxxx.xxxx.com. [xxx.xxx.xxx.xxx], dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:38 gateway sm-mta[1666]: r7S05Y9k041529: to=<root@xxxxx.xxxx.com>, delay=21:18:03, xdelay=00:00:00, mailer=esmtp, pri=4056415, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:38 gateway sm-mta[1666]: r7RMD82f032854: to=<root@xxxxx.xxxx.com>, delay=23:10:29, xdelay=00:00:00, mailer=esmtp, pri=4358268, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:38 gateway sm-mta[1666]: r7R05ZoO030163: to=<root@xxxxx.xxxx.com>, delay=1+21:18:02, xdelay=00:00:00, mailer=esmtp, pri=8402563, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:38 gateway sm-mta[1666]: r7R05ZoP030163: to=<root@xxxxx.xxxx.com>, delay=1+21:18:02, xdelay=00:00:00, mailer=esmtp, pri=8406961, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:38 gateway sm-mta[1666]: r7QMD8md023296: to=<root@xxxxx.xxxx.com>, delay=1+23:10:29, xdelay=00:00:00, mailer=esmtp, pri=8777438, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:38 gateway sm-mta[1666]: r7Q05ZvQ020977: to=<root@xxxxx.xxxx.com>, delay=2+21:18:01, xdelay=00:00:00, mailer=esmtp, pri=12812563, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:38 gateway sm-mta[1666]: r7Q05ZvR020977: to=<root@xxxxx.xxxx.com>, delay=2+21:18:01, xdelay=00:00:00, mailer=esmtp, pri=12816145, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:38 gateway sm-mta[1666]: r7PLh8BO016178: to=<root@xxxxx.xxxx.com>, delay=2+23:40:29, xdelay=00:00:00, mailer=esmtp, pri=13264392, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:39 gateway sm-mta[1666]: r7P05ZnM013827: to=<root@xxxxx.xxxx.com>, delay=3+21:18:03, xdelay=00:00:00, mailer=esmtp, pri=17222854, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:39 gateway sm-mta[1666]: r7P05ZnN013827: to=<root@xxxxx.xxxx.com>, delay=3+21:18:02, xdelay=00:00:00, mailer=esmtp, pri=17225327, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:39 gateway sm-mta[1666]: r7OMD7Nq012860: to=<root@xxxxx.xxxx.com>, delay=3+23:10:30, xdelay=00:00:00, mailer=esmtp, pri=17584852, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:39 gateway sm-mta[1666]: r7OAh76t008653: to=<root@xxxxx.xxxx.com>, delay=4+10:40:31, xdelay=00:00:00, mailer=esmtp, pri=19652037, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:39 gateway sm-mta[1666]: r7OAD76t008615: to=<root@xxxxx.xxxx.com>, delay=4+11:10:30, xdelay=00:00:00, mailer=esmtp, pri=19741946, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:39 gateway sm-mta[1666]: r7OAD76v008615: to=<root@xxxxx.xxxx.com>, delay=4+11:10:30, xdelay=00:00:00, mailer=esmtp, pri=19741998, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.

Aug 29 00:23:39 gateway sm-mta[1666]: r7OAD76u008615: to=<root@xxxxx.xxxx.com>, delay=4+11:10:30, xdelay=00:00:00, mailer=esmtp, pri=19741998, relay=xxxxx.xxxx.com., dsn=4.0.0, stat=Deferred: Connection refused by xxxxx.xxxx.com.
```

I have done `chmod 0755 /etc/mail` but still no result.

Please, help me to fix this problem 

P.S. Why there is still xxxxx.xxxx.com and root@xxxxx.xxxx.com in those messages, why not just xxxx.com?


----------



## SirDice (Aug 29, 2013)

You probably need to re-configure Sendmail. It doesn't change dynamically.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sendmail.html


----------



## DutchDaemon (Aug 29, 2013)

Also, a quick `cd /etc/mail && make all install restart` may help.


----------



## RedErick (Aug 29, 2013)

gpatrick said:
			
		

> Check /etc/mail/access  and /etc/mail/relay-domains



Unfortunately, I have no such files 



			
				DutchDaemon said:
			
		

> Also, a quick `cd /etc/mail && make all install restart` may help.



Cool idea! But still the same problem after `service sendmail restart` 



			
				SirDice said:
			
		

> You probably need to re-configure Sendmail. It doesn't change dynamically.
> 
> http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sendmail.html



I'm trying  People, thanks a lot for participating!


----------



## freebuser (Aug 29, 2013)

How about your `/etc/hosts` entry?


----------



## RedErick (Aug 29, 2013)

freebuser said:
			
		

> How about your `/etc/hosts` entry?



Hello! Well, first two lines in /etc/hosts are:

```
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
```


----------



## RedErick (Aug 29, 2013)

Maybe, I should change then as:

```
::1                     localhost xxxx.com
127.0.0.1               localhost xxxx.com
```


----------



## RedErick (Aug 29, 2013)

Changed, service sendmail restarted. Still the same. Again xxxx.xxxx.com and not xxxx.com


----------



## RedErick (Aug 29, 2013)

gpatrick said:
			
		

> Posting your sendmail.mc file would help immensely.



Hello! I have no such file. A file with closest name that I have is sendmail.cf. My sendmail even was never configured.


----------



## DutchDaemon (Aug 29, 2013)

If you ran the `make` correctly, you should have a _hostname_.mc


----------



## RedErick (Aug 29, 2013)

DutchDaemon said:
			
		

> If you ran the `make` correctly, you should have a _hostname_.mc



I ran `make` again but no such file in /etc/mail/.


----------



## RedErick (Aug 29, 2013)

The command `uname -a` also shows wrong e-mail (root@xxxx.xxxx.com):

```
FreeBSD xxxx.com 9.1-RELEASE FreeBSD 9.1-RELEASE #2: 
Thu Aug  8 11:58:05 EEST 2013 [HIGHLIGHT]root@xxxx.xxxx.com[/HIGHLIGHT]...
```
It should be root@xxxx.com instead.


----------



## SirDice (Aug 29, 2013)

Don't look too much at that. It's set when the kernel is built.


----------



## DutchDaemon (Aug 29, 2013)

Show `cd /etc/mail && ls -al`.


----------



## RedErick (Aug 29, 2013)

DutchDaemon said:
			
		

> Show `cd /etc/mail && ls -al`.


Please, sorry for Cyrillic localization. So, `cd /etc/mail && ls -al`:

```
total 984
drwxr-xr-x   2 root  wheel     512 29 Ð°Ð²Ð³ 16:41 .
drwxr-xr-x  20 root  wheel    2048 29 Ð°Ð²Ð³ 16:37 ..
-rw-r--r--   1 root  wheel    6816  4 Ð´ÐµÐº  2012 Makefile
-rw-r--r--   1 root  wheel    2902  4 Ð´ÐµÐº  2012 README
-rw-r--r--   1 root  wheel     634  4 Ð´ÐµÐº  2012 access.sample
-rw-r--r--   1 root  wheel    1674  4 Ð´ÐµÐº  2012 aliases
-rw-r-----   1 root  wheel  131072  4 Ð°Ð²Ð³ 21:03 aliases.db
-rw-r--r--   1 root  wheel   58283  4 Ð´ÐµÐº  2012 freebsd.cf
-rw-r--r--   1 root  wheel    3961  4 Ð´ÐµÐº  2012 freebsd.mc
-r--r--r--   1 root  wheel   40758  4 Ð´ÐµÐº  2012 freebsd.submit.cf
-r--r--r--   1 root  wheel     900  4 Ð´ÐµÐº  2012 freebsd.submit.mc
-rw-r--r--   1 root  wheel   58227 29 Ð°Ð²Ð³ 15:23 gateway.com.cf
-rw-r--r--   1 root  wheel    3961 29 Ð°Ð²Ð³ 15:23 gateway.com.mc
-rw-r--r--   1 root  wheel   40702 29 Ð°Ð²Ð³ 15:23 gateway.com.submit.cf
-r--r--r--   1 root  wheel     900 29 Ð°Ð²Ð³ 15:23 gateway.com.submit.mc
-r--r--r--   1 root  wheel    5657  4 Ð´ÐµÐº  2012 helpfile
-rw-r--r--   1 root  wheel     407  4 Ð´ÐµÐº  2012 mailer.conf
-rw-r--r--   1 root  wheel     250  4 Ð´ÐµÐº  2012 mailertable.sample
-r--r--r--   1 root  wheel   58227 29 Ð°Ð²Ð³ 16:41 sendmail.cf
-r--r--r--   1 root  wheel   40702 29 Ð°Ð²Ð³ 16:41 submit.cf
-rw-r--r--   1 root  wheel     576  4 Ð´ÐµÐº  2012 virtusertable.sample
```


----------



## DutchDaemon (Aug 29, 2013)

Apparently your system thinks it's called "gateway.com". Check `hostname`.


----------



## RedErick (Aug 29, 2013)

I got it right now (for a full view  ):

```
Aug 29 17:30:34 gateway sm-mta[39081]: r7OED76u009023: r7TEUWot039081: return to
 sender: Cannot send message for 5 days
Aug 29 17:30:34 gateway sm-mta[39081]: r7TEUWot039081: to=postmaster, delay=00:00:00, mailer=local, 
pri=35150, stat=queued
Aug 29 17:30:34 gateway sm-mta[39081]: r7OED76t009023: r7TEUWou039081: return to sender:
 Cannot send message for 5 days
Aug 29 17:30:34 gateway sm-mta[39081]: r7TEUWou039081: to=postmaster, delay=00:00:00, mailer=local, 
pri=35150, stat=queued
```


----------



## RedErick (Aug 29, 2013)

Sorry for the pause !


			
				DutchDaemon said:
			
		

> Apparently your system thinks it's called "gateway.com". Check `hostname`.




```
hostname
gateway.com
```

Yes, I changed the name "gateway.home.com"  to "gateway.com" and that decision was the start of  that problems... I would like to assign this new name to my system.


----------



## wblock@ (Aug 29, 2013)

That domain name is already in use.  Use a .local domain, or something else that will not conflict with existing domains out on the net.


----------



## RedErick (Aug 30, 2013)

Yes, you are right! :e I changed it to "gateway.local". I am still getting the same error messages:


```
Aug 30 17:53:30 gateway sm-mta[1373]: r7S05Y9j041529: to=<root@gateway.home.com>, delay=2+14:47:55, xdelay=00:00:00, mailer=esmtp, pri=17317777, relay=gateway.home.com. [66.114.124.140], dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
Aug 30 17:53:30 gateway sm-mta[1373]: r7S05Y9k041529: to=<root@gateway.home.com>, delay=2+14:47:55, xdelay=00:00:00, mailer=esmtp, pri=17736415, relay=gateway.home.com., dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
Aug 30 17:53:30 gateway sm-mta[1373]: r7RMD82f032854: to=<root@gateway.home.com>, delay=2+16:40:21, xdelay=00:00:00, mailer=esmtp, pri=17948268, relay=gateway.home.com., dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
Aug 30 17:53:30 gateway sm-mta[1373]: r7R05ZoP030163: to=<root@gateway.home.com>, delay=3+14:47:54, xdelay=00:00:00, mailer=esmtp, pri=21996961, relay=gateway.home.com., dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
Aug 30 17:53:30 gateway sm-mta[1373]: r7R05ZoO030163: to=<root@gateway.home.com>, delay=3+14:47:54, xdelay=00:00:00, mailer=esmtp, pri=22082563, relay=gateway.home.com., dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
Aug 30 17:53:30 gateway sm-mta[1373]: r7QMD8md023296: to=<root@gateway.home.com>, delay=3+16:40:21, xdelay=00:00:00, mailer=esmtp, pri=22367438, relay=gateway.home.com., dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
Aug 30 17:53:31 gateway sm-mta[1373]: r7Q05ZvQ020977: to=<root@gateway.home.com>, delay=4+14:47:54, xdelay=00:00:00, mailer=esmtp, pri=26582563, relay=gateway.home.com., dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
Aug 30 17:53:31 gateway sm-mta[1373]: r7Q05ZvR020977: to=<root@gateway.home.com>, delay=4+14:47:54, xdelay=00:00:00, mailer=esmtp, pri=26586145, relay=gateway.home.com., dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
Aug 30 17:53:31 gateway sm-mta[1373]: r7PLh8BO016178: to=<root@gateway.home.com>, delay=4+17:10:22, xdelay=00:00:00, mailer=esmtp, pri=27034392, relay=gateway.home.com., dsn=4.0.0, stat=Deferred: Connection refused by gateway.home.com.
```


----------



## wblock@ (Aug 30, 2013)

That domain is also in use.  Most that people can imagine already are registered.  Use .local, or even a subdomain of your ISP.


----------



## SirDice (Aug 30, 2013)

I would suggest not using .local as it interferes with Avahi/Zeroconf. For my home network I've used dicelan.home as a domain. Any random TLD will do, as long as it's not used on the Internet.


----------

