# Mail Server - Beginner questions



## bsus (Aug 28, 2011)

Hi,
I want to set up a Mail-Server.

I want to know which recommand way there is to do this. Let me start with the required packages:
Adminer
PHP
MySQL
Postfix
SPAM*
What is missing?

1. How can I imagine the integration with LDAP?
2. Are there problems running a mail server in jail?
3. Do I have to have a domain name for the server like *.dyndns.org?
4. How good can I migrate a mail server in the local network maybe such as instant messaging?

Regards, bsus


----------



## Sylhouette (Aug 28, 2011)

For a mailserver you need an MTA

This could be Postfix, sendmail, exim or qmail (these are the one's who come to mind first.)

Now you can send and receive mail.

Your clients however use an MUA (Mail User Agent)
This could be outlook, thunderbird or a webbased client.

These MUA's need to connect to the server and log in using a username/password combination.
Most used protocol for this is POP or IMAP

So you need an imap/pop server.
This could be dovecot, courier imap or cyrus imap. (also these come to mind first)


These two are the basics for a mailserver.

Now for the authentication, username and password storage.
You could use ldap, pam or a database  like postgreSQL or MySQL for this.

For a webmail client, you need a webserver.
Webservers you can use are apache, nginx or lighttp (also these comes to mind first.)

Webmail client are Roundcube webmail, Squirrelmail and Horde (again these come to mind first)

For spam filtering, i would use another machine which accept mail and wring it through the filters and deliver the clean mail to the actual mailserver.

So to go short.

I use for my mailservers a postfix with dovecot solution with a mysql backend to store the users.
Also i use postfixadmin to configure my domains and users.

Setting up an mailserver is not something you must take lightly.
My advise, test test and test.
Install postfix with dovecot and postfixadmin and try if it works.
Then do it again, reinstall everything.

Then add a webmail client to the mix.

There are full solutions like iRedmail.
this one uses also postfix dovecot and the like.

But be carefull not to become an open relay!


Also on the internet there are a lot of howto's how to install a postfix dovecot solution.
Try these as well, get to know the system.
Do not simply cut and paste, but try to understand what things do.

In the HOWTO section of this forum there is also a setup guide for a mailserver.
It has however not included a webbased gui for managing your users.

Good luck.

Also try exim instead of postfix.
and try a other webserver then apache.

Maybe you like exim more or not.
The only way to find out is to try them.

I would however stay away from qmail and sendmail.
Sendmail is a beast to configure.
Qmail is old, but some user do not want something else, it is all a mather of taste and liking.

Same goes for the pop/imap server.
I used to use courier, but switched to dovecot, because for me it was easier to understand and configure.
But again all a matter of taste.


regards
Johan


----------



## fonz (Aug 31, 2011)

bsus said:
			
		

> I want to set up a Mail-Server.



For starters, as pointed out by Sylhouette, setting up and maintaining a mail server is not a walk in the park. There are lots of questions to be asked, lots of decisions to be made and depending on exactly what you wish to accomplish there might be lots of components that all need to be installed, configured, tested, maintained and made to play nice together. Sylhouette has made some good points but not everything might apply to you. Or the other way around, it may not answer all of your questions. You'll have to be a lot more specific than just saying you want to set up "a mail server".

For example, can you answer the following questions:

Have you read up (or did you know that stuff already) on background knowledge about how e-mail works behind the scenes? For example, do you know what an MTA is? An MDA? An MUA? Do you know how mail actually gets from the sender to the receiver(s)? What role DNS plays in this process? Do you have at least a broad conception of how the SMTP protocol works?
Is there a (sub)domain for which the server is going to handle mail or will you just use an existing account at your ISP/company/university? In the latter case, can you explain why you even want to run your own mail server in the first place?
Will the server be just for you or will you be handling mail for other people too?
Will the server run on a dedicated machine or is the machine used for other things too?
Will the server be behind a firewall and/or NAT?
Have you thought about disk space planning?
Security?
Privacy issues?
Disaster recovery?
Has that been *tested* lately?
Do you know what fallback MX is and more to the point, do you have it?
Will or might there be mailing lists involved?
Will the end user(s) access their mail directly by logging into the server or is remote access required?

Depending on the answers there will be follow-up questions.



			
				bsus said:
			
		

> Adminer
> PHP
> MySQL


These three _might_ be part of your solution but they have nothing to do with mail servers _per se_. You may or may not need them.

Hope this helps,

Fonz


----------



## bsus (Sep 1, 2011)

@Sylhouette
Thanks for the much information. Now I know which packages to use. Will use them when beginning (MySQL, Dovekit, Postfix,) I would first try without webinterface then I have to see how this is in practise.

@fonz


> Have you read up (or did you know that stuff already) on background knowledge about how e-mail works behind the scenes? For example, do you know what an MTA is? An MDA? An MUA? Do you know how mail actually gets from the sender to the receiver(s)? What role DNS plays in this process? Do you have at least a broad conception of how the SMTP protocol works?


I have a very rough picture. But I don't think that it will be a big thing too read a little more about this.


> Is there a (sub)domain for which the server is going to handle mail or will you just use an existing account at your ISP/company/university? In the latter case, can you explain why you even want to run your own mail server in the first place?


Heres one big problem. Actually I only have a dyndns account but it could be that I will buy in future a real domain. I would run it first over the dyndns and then later over a real domain


> Will the server be just for you or will you be handling mail for other people too?


 At the beginning just for me, when I am safe I would have about ~10 Accounts.


> Will the server run on a dedicated machine or is the machine used for other things too


 Herefor I use an extra jail on a file-server


> Will the server be behind a firewall and/or NAT?


Yes


> Have you thought about disk space planning?


Yes


> Security?


A little


> Privacy issues?


Wouldn't be my own server safe?


> Disaster recovery?


This would be a problem


> Do you know what fallback MX is and more to the point, do you have it?


Unfortunatly I don't know


> Will or might there be mailing lists involved?


No


> Will the end user(s) access their mail directly by logging into the server or is remote access required?


I thought about using an external email client like evolution

Thanks for the much question you gave me. I know that there will come much work to do.

Regards


----------

