# Sendmail not working properly



## Avirdoz (Mar 11, 2011)

System - FreeBSD 8.0-RELEASE-p1
Sendmail version - ESMTP Sendmail 8.14.3/8.14.3
When started, says that everything is in order

```
# cd /etc/mail/
# make start
Starting: sendmail sendmail-clientmqueue.
# ps aux | grep sendmail
root   96972  0.0  0.0 11080  3752  ??  Ss    3:59PM   0:00.00 sendmail: accepting connections (sendmail)
smmsp  96975  0.0  0.0 11080  3648  ??  Ss    3:59PM   0:00.00 /usr/sbin/sendmail -L sm-msp-queue -Ac -q30m
```
With this in /var/spool/clientmqueue no PID file of sendmail-clientmqueue and mail in this directory does not go away. Directory permissions smmsp: smmsp 770.
Sendmail config:

```
divert(-1)
divert(0)
VERSIONID(`$FreeBSD: src/etc/sendmail/freebsd.mc,v 1.29 2003/12/24 21:15:09 gshapiro Exp $')
OSTYPE(freebsd5)
DOMAIN(generic)
FEATURE(access_db, `hash -o -T<TMPF> /etc/mail/access')
FEATURE(blacklist_recipients)
FEATURE(local_lmtp)
FEATURE(local_procmail)
FEATURE(relay_entire_domain)
FEATURE(mailertable, `hash -o /etc/mail/mailertable')
FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')
define(`confCW_FILE', `-o /etc/mail/local-host-names')
DAEMON_OPTIONS(`Name=IPv4, Family=inet')
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')
define(`confNO_RCPT_ACTION', `add-to-undisclosed')
define(`confPRIVACY_FLAGS', `authwarnings,noexpn,novrfy')
define(`confQUEUE_LA', `100')
define(`confREFUSE_LA', `80')
define(`confMAX_MESSAGE_SIZE',`12000000')
define(`confMILTER_MACROS_HELO', confMILTER_MACROS_HELO`, {verify}')dnl
INPUT_MAIL_FILTER(`smf-sav', `S=unix:/var/run/smfsav/smfsav.sock, T=S:30s;R:4m')dnl
INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')
define(`confINPUT_MAIL_FILTERS', `smf-sav,spamassassin')
MAILER(procmail)
MAILER(local)
MAILER(smtp)
```
/var/log/maillog is empty.
Need some help.


----------



## DutchDaemon (Mar 11, 2011)

[cmd=]service sendmail status[/cmd]

This should give you something like:


```
sendmail is running as pid 1190.
sendmail_submit is running as pid 1190.
sendmail_clientmqueue is running as pid 1198.
```

[cmd=]service sendmail rcvar[/cmd]


```
# sendmail
#
sendmail_enable="NO"
#   (default: "")

# sendmail_submit
#
sendmail_enable="NO"
#   (default: "")
sendmail_submit_enable="YES"
#   (default: "")

# sendmail_clientmqueue
#
sendmail_enable="NO"
#   (default: "")
sendmail_submit_enable="YES"
#   (default: "")
sendmail_msp_queue_enable="YES"
#   (default: "")
```

[cmd=]ps ax | grep sendmail[/cmd]


```
1190  ??  Ss     0:00.36 sendmail: accepting connections (sendmail)
 1198  ??  Is     0:00.01 sendmail: Queue runner@00:30:00 for /var/spool/clientmqueue (sendmail)
```


----------



## Avirdoz (Mar 11, 2011)

I'm not sure but think that FreeBSD haven't 'service' utility, however:

```
> service
service: Command not found.
> /bin/service
/bin/service: Command not found.
> /sbin/service
/sbin/service: Command not found.
> /usr/local/bin/service
/usr/local/bin/service: Command not found.
> /usr/local/sbin/service
/usr/local/sbin/service: Command not found.
```


----------



## DutchDaemon (Mar 11, 2011)

You mean: _your_ version of FreeBSD does not have it:


```
$ which service
/usr/sbin/service
```


```
HISTORY
     The service manual page service first appeared in FreeBSD 7.3.
```

If you're on 8.x, you should have service(8).

Substitute 'service' with '/etc/rc.d/' then.

`/etc/rc.d/sendmail status`
`/etc/rc.d/sendmail rcvar`


----------



## Avirdoz (Mar 11, 2011)

[CMD=""]/etc/rc.d/sendmail status[/CMD]

```
sendmail is running as pid 96972.
sendmail_clientmqueue is not running.
```
[CMD=""] ps ax | grep sendmail[/CMD]

```
296  ??  Ss     0:04.86 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
  921  ??  Ss     0:02.07 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
96972  ??  Ss     0:01.23 sendmail: accepting connections (sendmail)
96975  ??  Ss     0:24.49 /usr/sbin/sendmail -L sm-msp-queue -Ac -q30m
96987  ??  Ss     0:24.70 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
97203  ??  Ss     0:21.80 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
97500  ??  Ss     0:18.84 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
97774  ??  Ss     0:15.94 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
98142  ??  Ss     0:13.22 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
98320  ??  Ss     0:10.42 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
99481  ??  Ss     0:07.67 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t
 1630   0  S+     0:00.00 grep sendmail
```
I think 
	
	



```
96975  ??  Ss     0:24.49 /usr/sbin/sendmail -L sm-msp-queue -Ac -q30m
```
is a sendmail_clientmqueue, but when it started pid file wasn't create.


----------



## DutchDaemon (Mar 11, 2011)

```
Queue runner@00:30:00 for /var/spool/clientmqueue (sendmail)
```
 should be running.

If you have no entries for Sendmail in /etc/rc.conf (and you shouldn't, unless you're running an SMTP server for inbound email), the entries in /etc/defaults/rc.conf will make sure that all necessary Sendmail processes are started (unless you altered /etc/defaults/rc.conf, which you should *never* do)

[cmd=]/etc/rc.d/sendmail rcvar | grep ^sendmail[/cmd] should give you:


```
sendmail_enable="NO"
sendmail_enable="NO"
sendmail_submit_enable="[B]YES[/B]"
sendmail_enable="NO"
sendmail_submit_enable="[B]YES[/B]"
sendmail_msp_queue_enable="[B]YES[/B]"
```

The last one empties the local queue (clientmqueue).

The relevant block in /etc/defaults/rc.conf (the one you should never edit) should look like this:


```
##############################################################
###  Mail Transfer Agent (MTA) options  ######################
##############################################################

mta_start_script="/etc/rc.sendmail"
                        # Script to start your chosen MTA, called by /etc/rc.
# Settings for /etc/rc.sendmail and /etc/rc.d/sendmail:
sendmail_enable="NO"    # Run the sendmail inbound daemon (YES/NO).
sendmail_pidfile="/var/run/sendmail.pid"        # sendmail pid file
sendmail_procname="/usr/sbin/sendmail"          # sendmail process name
sendmail_flags="-L sm-mta -bd -q30m" # Flags to sendmail (as a server)
sendmail_submit_enable="YES"    # Start a localhost-only MTA for mail submission
sendmail_submit_flags="-L sm-mta -bd -q30m -ODaemonPortOptions=Addr=localhost"
                                # Flags for localhost-only MTA
sendmail_outbound_enable="YES"  # Dequeue stuck mail (YES/NO).
sendmail_outbound_flags="-L sm-queue -q30m" # Flags to sendmail (outbound only)
sendmail_msp_queue_enable="YES" # Dequeue stuck clientmqueue mail (YES/NO).
sendmail_msp_queue_flags="-L sm-msp-queue -Ac -q30m"
                                # Flags for sendmail_msp_queue daemon.
sendmail_rebuild_aliases="NO"   # Run newaliases if necessary (YES/NO).
```


----------



## Avirdoz (Mar 11, 2011)

[CMD=""]> sudo /etc/rc.d/sendmail rcvar | grep ^sendmail[/CMD]

```
sendmail_enable=NO
sendmail_submit_enable=YES
sendmail_msp_queue_enable=YES
```
[CMD=""]> sudo /etc/rc.d/sendmail status[/CMD]

```
Cannot 'status' sendmail. Set sendmail_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
sendmail_submit is not running.
sendmail_clientmqueue is not running.
```
[CMD=""]> sudo /etc/rc.d/sendmail onestatus[/CMD]

```
sendmail is not running.
sendmail_submit is not running.
sendmail_clientmqueue is not running.
```

One way to start:
[CMD=""]> pwd[/CMD]

```
/etc/mail
```
[CMD=""]> sudo make start[/CMD]

```
Starting: sendmail-submit sendmail-clientmqueue.
```
[CMD=""]> ps ax | grep sendmail[/CMD]

```
4376  ??  Ss     0:00.00 sendmail: accepting connections (sendmail)
4379  ??  Ss     0:00.01 /usr/sbin/sendmail -L sm-msp-queue -Ac -q30m
```
[CMD=""]> sudo /etc/rc.d/sendmail onestatus[/CMD]

```
sendmail is running as pid 4424.
sendmail_submit is running as pid 4424.
sendmail_clientmqueue is not running.
```

2nd:
[CMD=""]> sudo /etc/rc.d/sendmail onestatus[/CMD]

```
sendmail is not running.
sendmail_submit is not running.
sendmail_clientmqueue is not running.
```
[CMD=""]> sudo /etc/rc.d/sendmail start[/CMD]

```
Cannot 'start' sendmail. Set sendmail_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'
```
.
[CMD=""]> sudo /etc/rc.d/sendmail onestatus[/CMD]

```
sendmail is running as pid 4516.
sendmail_submit is running as pid 4516.
sendmail_clientmqueue is not running.
```
[CMD=""]> ps ax | grep sendmail[/CMD]

```
4516  ??  Ss     0:00.00 sendmail: accepting connections (sendmail)
4520  ??  Ss     0:00.05 /usr/sbin/sendmail -L sm-msp-queue -Ac -q30m
4537   0  S+     0:00.00 grep sendmail
```

3rd:
[CMD=""]> sudo /etc/rc.d/sendmail stop[/CMD]

```
Cannot 'stop' sendmail. Set sendmail_enable to YES in /etc/rc.conf or use 'onestop' instead of 'stop'.
Stopping sendmail_submit.
sendmail_clientmqueue not running? (check /var/spool/clientmqueue/sm-client.pid).
```
[CMD=""]> sudo killall -9 sendmail
> sudo /etc/rc.d/sendmail start[/CMD]

```
Cannot 'start' sendmail. Set sendmail_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'.
```
[CMD=""]> ps ax | grep sendmail[/CMD]

```
4593  ??  Ss     0:00.00 sendmail: accepting connections (sendmail)
4597  ??  Ss     0:00.01 /usr/sbin/sendmail -L sm-msp-queue -Ac -q30m
4599   0  S+     0:00.00 grep sendmail
```

In all cases /var/spool/clientmqueue/sm-client.pid not detected.


----------



## DutchDaemon (Mar 12, 2011)

If /var/log/messages and/or /var/log/maillog do not cry 'foul' about something, I have no idea what might be wrong.


----------

