2014-08-20

Private MailBox on Raspberry Pi


Buy a domain "something.com" or "somethingelse.eu" or what ever.
For my domain name, I paid ~10 euro for a year.
I bought from http://www.serveriai.lt/
I assume that Raspberry Pi you already have. And You also have stable internet at home and you can access your network from outside it means external static IP or IP that changes very rarely.
 
If you thinking , why do I need this, there is a lot free mail accounts on google yahoo etc...
Don't ask me! I am gonna ignore you!

Installation:

# aptitude install lighttpd

# aptitude install postfix  

# aptitude install dovecot-core dovecot-imapd

download roundcube and extract to /var/www/

install by following instructions in
http://<yourDomainName>/roundcubemail/installer/

Configuration:

lighttpd have to be configured for php support, more info about it is in here

Add your domain name to:
$ sudo nano /etc/hosts
127.0.0.1    localhost <domanName>

Testing:

Make sure tcp ports are open:

# netstat -nat
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      lighttpd
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN    dovecot
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      postfix
 

For you to get mail's outside your local network, You have to open tcp port 25 for public in your router, but right after you open to public, definitely test you postfix configuration otherwise you can be banned for spam. 
Test is very easy:


http://www.mailradar.com/openrelay/


Adding user for mail:


# adduser <userName>
# usermod -a -G mail <userName>


If you want to add <firstName.lastName> do it like this:
 
# adduser --force-badname <firstName.lastName>


 




 

It's not super fast, but it fast enough for me to use it. I am still testing...  but I like it so far!




** Update **


You will be spammer by default unless your internet provider can help you and set "reversDNS" for you.

So now I have to decide, ether I change my internet provider and pay more money and than continue with mail box or spare some money and forget this idea.