# Little sendmail server with Roundcube and POP/SMTP



## Dare (Feb 1, 2013)

Hey,

I'm trying to set up for myself and my friends a tiny ipv4 + ipv6 mail server (finally with web interface like Roundcube) on my machine which will authenticate user using system password, so as you can see I don't have high requirements, but unfortunately I cannot get it working and I am missing something in trying to diagnose. 

Let's start from the beginning checking domains first:
[CMD="host"]mydomain.tld[/CMD]

```
mydomain.tld has address MY.WAN.IP.ADDRESS
mydomain.tld mail is handled by 10 mydomain.tld.
```

[cmd="dig"]mx mydomain.tld[/cmd]

```
; <<>> DiG 9.8.1-P1 <<>> mx mydomain.tld
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52543
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;mydomain.tld.      IN  MX

;; ANSWER SECTION:
mydomain.tld.  10800    IN  MX      10 mydomain.tld.

;; Query time: 147 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Fri Feb  1 03:12:04 2013
;; MSG SIZE  rcvd: 50
```

Seems like DNS is set up properly. Another thing which comes in mind: rc.conf
Assuming that if sendmail would be enabling user to use POP and SMTP protocols in their remote mail clients so it should act as daemon:
[cmd="cat"]/etc/rc.conf | grep sendmail[/cmd]

```
sendmail_enable="YES"
sendmail_submit_enable="YES"
sendmail_outbound_enable="YES"
sendmail_msp_queue_enable="YES"
```

OK, so let's start the service:
[cmd="sudo"]service sendmail start[/cmd]

```
Starting sendmail.
```

...and check if it's really running:
[cmd="sudo"]ps auxww | grep sendmail[/cmd]

```
dare       8418   0,0  0,0   9748   1384   1  S+    3:26       0:00,00 grep sendmail
```

Not good. Let's give it a try using [cmd="mail"]-s "Testing mail from console" "myprivateaddress@gmail.com"[/cmd]:

```
Test message
.
```

Nothing happened, either mail was not delivered. Let's verbose it:
[cmd="mail"]-v "myprivateaddress@gmail.com"[/cmd]

```
Subject: Another test
Let's give this a try...
.
EOT
myprivateaddress@gmail.com... Connecting to [127.0.0.1] via relay...
myprivateaddress@gmail.com... Deferred: Connection reset by [127.0.0.1]
```

OK, let's go to the configuration files:
/etc/mail/local-host-names

```
mydomain.tld
```
Seems legit...
/etc/mail/virtualtable

```
dare@mydomain.tld dare
```
...same here
/etc/mail/mailer.conf

```
#
# Execute the Postfix sendmail program, named /usr/local/sbin/sendmail
#
sendmail   /usr/local/sbin/sendmail
send-mail  /usr/local/sbin/sendmail
mailq      /usr/local/sbin/sendmail
newaliases /usr/local/sbin/sendmail
```
Just the defaults, aswell as sendmail.cf
/var/log/messages and /var/log/maillog are just empty...

but! 
[cmd="sudo"]tail /var/log/all.log[/cmd]

```
Feb  1 03:45:00 lucyfer /usr/sbin/cron[8519]: (root) CMD (/usr/libexec/atrun)
Feb  1 03:45:45 lucyfer master[8520]: fatal: master_spawn: exec /usr/local/libexec/postfix/smtpd: No such file or directory
Feb  1 03:45:45 lucyfer kernel: Feb  1 03:45:45 lucyfer master[8520]: fatal: master_spawn: exec /usr/local/libexec/postfix/smtpd: No such file or directory
Feb  1 03:45:46 lucyfer postfix/master[97319]: warning: process /usr/local/libexec/postfix/smtpd pid 8520 exit status 1
Feb  1 03:45:46 lucyfer postfix/master[97319]: warning: /usr/local/libexec/postfix/smtpd: bad command startup -- throttling
Feb  1 03:46:46 lucyfer master[8523]: fatal: master_spawn: exec /usr/local/libexec/postfix/smtpd: No such file or directory
Feb  1 03:46:46 lucyfer kernel: Feb  1 03:46:46 lucyfer master[8523]: fatal: master_spawn: exec /usr/local/libexec/postfix/smtpd: No such file or directory
Feb  1 03:46:47 lucyfer postfix/master[97319]: warning: process /usr/local/libexec/postfix/smtpd pid 8523 exit status 1
Feb  1 03:46:47 lucyfer postfix/master[97319]: warning: /usr/local/libexec/postfix/smtpd: bad command startup -- throttling
Feb  1 03:47:05 lucyfer sudo:     dare : TTY=pts/1 ; PWD=/etc/mail ; USER=root ; COMMAND=/usr/bin/tail /var/log/all.log
```

OK, seems like postfix was still running, so...
[cmd="sudo"]killall postfix[/cmd] did the trick.

Retrying verbosed mail command gave me:
[cmd="mail"]-v myprivateaddress@gmail.com[/cmd]

```
Subject: Maybe now you'll like to work, sendmail?
Delivery test.
.
EOT
myprivateaddress@gmail.com... Connecting to [127.0.0.1] via relay...
myprivateaddress@gmail.com... Deferred: Connection refused by [127.0.0.1]
```

So restarting sendmail service, again:
[cmd="sudo"]service sendmail start[/cmd]

which actually did the trick! So now after checking with 
`# mail` command I've landed with 2 unread mails, yay!

Trying to send mail from remote telnet gave me 550 error: Relaying Denied, but I've created /etc/mail/relay-domains file and put there few tlds and retry passed, so it's good news. 

Now my question is what's the next step? Shall I install now Roundcube or I need some management tool in between them to connect? Or maybe shall I try to configure ipv6 mail?

Sorry for unprofesional description, but I am new to configuring mails and I may not understood something properly. (but I'm willing to)

Much appreciated!


----------

