# mail command and default hostname



## tw9JRlkTEjXpoUlo09jc (Sep 16, 2013)

Hello,

I'm having two jails one called J1 the other one called J2. They are both hosted on example.com.

On J1 when I type the following command `echo test | mail joe` the mail is delivered correctly to joe@example.com.
On J2 when I type the following command `echo test | mail joe` the mail is delivered to joe@J2.example.com, which is an error.

The hostnames of my jails are correctly set and returned for example by the `hostname` command.

I'm using Postfix and Dovecot to deliver.

main.cf contains

```
myhostname=example.com
mydomain=example.com
```

How is the default host chosen by the mail command?


----------



## tw9JRlkTEjXpoUlo09jc (Sep 24, 2013)

I found the solution to the problem.

The J1 jail had the following content in  /etc/mail/mailer.conf 


```
sendmail        /usr/local/sbin/sendmail
send-mail       /usr/local/sbin/sendmail
mailq           /usr/local/sbin/sendmail
newaliases      /usr/local/sbin/sendmail
```
whereas J2 had the following:


```
sendmail        /usr/libexec/sendmail/sendmail
send-mail       /usr/libexec/sendmail/sendmail
mailq           /usr/libexec/sendmail/sendmail
newaliases      /usr/libexec/sendmail/sendmail
hoststat        /usr/libexec/sendmail/sendmail
purgestat       /usr/libexec/sendmail/sendmail
```
The former configuration allows postfix to replace sendmail and solves the problem


----------

