# Simple mail setup for local mail server



## z3R0 (Mar 11, 2014)

I have several perl scripts that need to mail logs, error msgs etc... and need to set up a local mail server. 

I have smtp port 25 opened  and have installed postfix and dovecot based on this guide: 
http://bsdbox.co/2014/01/28/mail-server-postfix-dovecot-on-freebsd/

I'm not too sure about the TLS and SASL settings as its not really explained well in the guide (creating the certs, keys, pem vs crt/crs etc...)
Can I send local mail with just postfix and do without dovecot?

Would setting up local domain delivery allow emails to reach exchange server users (within the same domain.tld)?
I have more questions then answers.

Anything as easy as this (but for FreeBSD)? https://www.digitalocean.com/community/articles/how-to-install-and-setup-postfix-on-ubuntu-12-04

I would really appreciate any help!

Thanks!


----------



## ondra_knezour (Mar 11, 2014)

If you just need to send some messages from local services, then you probably can go with the Sendmail, which is part of the FreeBSD base. Just do `cd /etc/mail && make all install restart` as root.

You don't need Dovecot to send messages. If you want to get messages delivered locally to root, just change /etc/mail/aliases, there is example at the begining and do `make` as above.

TLS isn't necessary either if you don't require encryption or the target server doesn't refuse unecrypted communication.

One usefull tip - you can specify "smarthost", which will get all messages from your server to send anywhere in the world. After first `make` in /etc/mail directory, there will be created file with name of your machine and .mc extension. Locate line 
	
	



```
dnl define(`SMART_HOST', `your.isp.mail.server')
```
 and change it to 
	
	



```
define(`SMART_HOST', `smtp_in_your_network')
```

Sendmail is little picky about DNS, so be sure you have fully qualified name for your machine.


----------



## z3R0 (Mar 12, 2014)

Well the email needs to pass through an Exchange server via SMTP.

I'd prefer Postfix over Sendmail. So far I have Postfix running but I receive this error:


```
530 5.7.1 Client was not authenticated (in reply to MAIL FROM command))
```

The sysadmin says that no authentication is required, but telnet yields the following:


```
250] 'SIZE'
[250] 'PIPELINING'
[250] 'DSN'
[250] 'ENHANCEDSTATUSCODES'
[250] 'STARTTLS'
[250] 'X-ANONYMOUSTLS'
[b][250] 'AUTH NTLM'[/b]
[250] 'X-EXPS GSSAPI NTLM'
[250] '8BITMIME'
[250] 'BINARYMIME'
[250] 'CHUNKING'
[250] 'XEXCH50'
[250] 'XRDST'
[250] 'XSHADOW'
```
Other Linux servers can send mail with no problem. The only thing I notice in their Postfix config is SASL.

So I'm guessing SASL is the authentication method. I would need help setting up SASL with Postfix. I'm not exactly sure how SASL works/what it requires to run properly.

Thanks for the help!


----------



## trh411 (Mar 12, 2014)

z3R0 said:
			
		

> The only thing I notice in their postfix config is sasl. So I'm guessing sasl is the authentication method. I would need help setting up sasl with postfix. I'm not exactly sure how sasl works/what it requires to run properly.


Maybe take a look at Postfix SASL Howto? Just one of many to choose form.


----------

