# Has anybody made an email server with OpenSMTPD?



## baronobeefdip (Oct 1, 2013)

I have been using Postfix and Dovecot for some time and started wondering if there was an alternative that can be used in FreeBSD. I have stumbled upon OpenSMTPD which *I* pre-installed in OpenBSD. In recent versions from what I have been seeing. It might be an easy task to configure but interpreting the guides I am finding from the internet are a challenge in and of themselves. I was wondering if there is a way to make an email server with OpenSMTPD and an IMAP and POP3 server. (I have heard of Dovecot but neither FreeBSD or OpenBSD come with Dovecot on the disk or pre-installed. I want to know if there is an IMAP service pre-installed on OpenBSD. FreeBSD must have something in the packages on the DVD but is there anything that I can use to accomplish IMAP capabilities in OpenBSD without installing anything?)


----------



## johnblue (Oct 2, 2013)

baronobeefdip said:
			
		

> I have stumbled upon OpenSMTPD which ... might be an easy task to configure but interpreting the guides I am finding from the internet are a challenge in and of themselves.



Here are OpenSMTPD thoughts in one particular guide found on the web:

https://www.poolp.org/calomel

That said, you might be able get some information by sorting through the links found here:

https://www.poolp.org/by/tag/opensmtpd


----------



## gilles (Oct 2, 2013)

*H*i,

*S*etting up OpenSMTPD with Dovecot is straightforward, the smtpd part is basically just:


```
listen on 0.0.0.0
    
    accept from any for domain yourdomain.com deliver to maildir
    accept from local for any relay
```
then you configure Dovecot to use maildir and you're all set ;-)


----------



## mix_room (Oct 2, 2013)

There is a port mail/opensmtpd, which makes it really easy to install. 

I have OpenSMTPD runnning in order to forward mail to a relay, was a breeze to install and configure. (Thanks Gilles). 

I haven't tried any local mail forwarding with it, but assume that it would work just as well.


----------



## baronobeefdip (Oct 2, 2013)

I am guessing that relay means that you have to have *P*ostfix installed? I am trying to avoid that because I am trying to install it on a machine that doesn't have internet access. I work in a lab environment and I am restricted from internet for specific purposes. The point was to make an SMTP server without *P*ostfix. Unless there no other way and I need to use *P*ostfix. I am also questioning why all of the guides have the listening interface as the loopback one. I am not looking to make a mail server that will only exchange emails within itself. I want it to exchange emails with other email servers on my network. (soon on the entire internet if I ever get the thing working). I guess the reason why I am having such a hard time doing this is because the documentation that I have found (and the ones you provided) are always telling me how to send mail to local users. I want it not only to send it to local users but I also want it to be able to send mail to another email server. as for names of the domains and where those email exchanges should go will be up to the DNS server.

If I am to install *P*ostfix and *D*ovecot on OpenBSD then will I need depend*e*ncies.


----------



## mix_room (Oct 2, 2013)

baronobeefdip said:
			
		

> I am guessing that relay means that you have to have postfix installed? I am trying to avoid that because I am trying to install it on a machine that doesn't have internet access.


No, I only used that particular machine to send email, and my provider was restricting sending email to a particular port, and particular hostnames, and requiring authentication. I couldn't get it working with sendmail. 

My smtpd.conf looks as follows

```
listen on 127.0.0.1 port 25
expire 4h

table aliases file:/etc/mail/aliases
table secrets file:/usr/local/etc/mail/mail-secrets

accept from local for local alias <aliases> deliver to mbox
accept from local for any relay via tls+auth://USER@HOSTNAME:PORT auth <secrets>
```
What it does is forward email to local users to their mbox, and other email is forwarded to HOSTNAME in order for further processing, ie sending to 'the internet'. No one is supposed to send email directly to the machine, so it only listens on localhost.


----------



## baronobeefdip (Oct 3, 2013)

So will that setting use the users on the machine as email accounts on the machine? Is there a special setting that goes into the file for it to do that?


----------



## mix_room (Oct 4, 2013)

There is a number of settings which can be used. However, in my case I only have a very limited number of users (2) which are supposed to be able to get mail.

`# echo "testmail" | mail -s "test" mix_room` delivers mail to the local system, while `# echo "testmail" | mail -s "test" [email=mix_room@external.tld]mix_room@external.tld[/email]` delivers to my 'real-world' account.


----------



## SirDice (Oct 4, 2013)

baronobeefdip said:
			
		

> If I am to install *P*ostfix and *D*ovecot on OpenBSD then will I need depend*e*ncies.


Please ask OpenBSD related questions on the OpenBSD forums. We can only help you getting it running on FreeBSD.


----------

