Quickstart Guide
Get a package
- Auto built (latest) http://autobuild.jsmtpd.org
- Releases http://sourceforge.net/project/showfiles.php?group_id=132129
Unpack
Packages are tar.bz2 archives.
- On Linux, use something like "tar jxvf Jsmtpd-xxx.tar.bz2"
- On Windows, use a archiver able to unpack them (winrar is one example)
You get a directory holding a jsmtpd installation
Start me up (Windows)
Get in the Jsmtpd's directory. In command shell, execute startup.bat, or double click on it in explorer. You'll get a window with
G:\Jsmtpd-200604041051\Jsmtpd>startup.bat .;etc\;lib\commons-logging.jar;lib\crypt.jar;lib\dnsjava-1.6.5.jar;lib\jsmtpd-core.jar;lib\log4j-1.2.9.jar;lib\tiger-jav amail-1.0.jar;lib\xercesImpl.jar;lib\xmlParserAPIs.jar;plugins\basicPlugins.jar;plugins\jsmtpd-snippet.jar;plugins\filte rs\ClamAV\jsmtpd-clamav.jar;plugins\filters\SA\jsmtpd-SA.jar;plugins\filters\Jasen\commons-beanutils.jar;plugins\filters \Jasen\commons-collections-3.1.jar;plugins\filters\Jasen\commons-digester.jar;plugins\filters\Jasen\fastutil-4.3.1-jasen .jar;plugins\filters\Jasen\jasen.jar;plugins\filters\Jasen\jsmtpd-jasen.jar;plugins\filters\Jasen;plugins\inputIPFilters \jsmtpd-inputIPFilters.jar 0 [main][ INFO] org.jsmtpd.Controler - Jsmtpd 0.6a-unstable, Copyright (C) 2005 Jean-Francois Poux - jfp@jsmtpd.org 0 [main][ INFO] org.jsmtpd.Controler - Jsmtpd comes with ABSOLUTELY NO WARRANTY; 0 [main][ INFO] org.jsmtpd.Controler - This is free software, and you are welcome to redistribute it under certain conditions; 0 [main][ INFO] org.jsmtpd.Controler - See the LICENCE file for details 0 [main][ INFO] org.jsmtpd.Controler - Server starting ... 625 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.dnsServices.DNSJavaResolver, set DnsServers=192.168.10.1 641 [main][ INFO] org.jsmtpd.Controler - DNS Service plugin loaded : DNSJava resolver plugin for jsmptd 641 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set RelayedHosts=10.0.0.0/255.255.0.0,127.0.0.1 641 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set ValidUsers=*@localhost,*@yourdomain.com 641 [main][ INFO] org.jsmtpd.Controler - ACL Service plugin loaded : Simple Acces Control List plugin for jsmtp 656 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter, set MailDir=mailboxes/ 656 [main][ INFO] org.jsmtpd.Controler - Local Delivery Service plugin loaded : UnixMailboxWriter plugin for jsmtpd 672 [main][ INFO] org.jsmtpd.Controler - Remote Delivery Service plugin loaded : RemoteSmtpSender plugin fort jsmptd 672 [main][ INFO] org.jsmtpd.Controler - Input IP filter chain loaded 688 [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 3 threads 703 [main][DEBUG] org.jsmtpd.core.send.QueueService - Buffer set to 16 messages max for immediate processing 703 [main][DEBUG] org.jsmtpd.core.send.QueueService - Storage usage 0/1024 (in Mo) 703 [ThreadPoolControl-9][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 703 [main][ INFO] org.jsmtpd.core.receive.Receiver - Listening for connections on port 25 703 [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 1 threads 719 [ThreadPoolControl-14][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 719 [main][ INFO] org.jsmtpd.Controler - Delivery service started 735 [main][ INFO] org.jsmtpd.Controler - Server running
That's it, Jsmtpd is running. Use Control+C to stop it.
Start me up (Linux)
Get execution rights on the startup.sh script :
chmod 700 startup.sh
Then fire up jsmtpd :
./startup.sh
You should get something like :
1 [main][ INFO] org.jsmtpd.Controler - Jsmtpd 0.6a-unstable, Copyright (C) 2005 Jean-Francois Poux - jfp@jsmtpd.org 8 [main][ INFO] org.jsmtpd.Controler - Jsmtpd comes with ABSOLUTELY NO WARRANTY; 11 [main][ INFO] org.jsmtpd.Controler - This is free software, and you are welcome to redistribute it under certain conditions; 12 [main][ INFO] org.jsmtpd.Controler - See the LICENCE file for details 13 [main][ INFO] org.jsmtpd.Controler - Server starting ... 1545 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.dnsServices.DNSJavaResolver, set DnsServers=192.168.10.1 1580 [main][ INFO] org.jsmtpd.Controler - DNS Service plugin loaded : DNSJava resolver plugin for jsmptd 1595 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set RelayedHosts=10.0.0.0/255.255.0.0,127.0.0.1 1599 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set ValidUsers=*@localhost,*@yourdomain.com 1600 [main][ INFO] org.jsmtpd.Controler - ACL Service plugin loaded : Simple Acces Control List plugin for jsmtp 1736 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter, set MailDir=mailboxes/ 1737 [main][ INFO] org.jsmtpd.Controler - Local Delivery Service plugin loaded : UnixMailboxWriter plugin for jsmtpd 2134 [main][ INFO] org.jsmtpd.Controler - Remote Delivery Service plugin loaded : RemoteSmtpSender plugin fort jsmptd 2137 [main][ INFO] org.jsmtpd.Controler - Input IP filter chain loaded 2155 [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 3 threads 2194 [main][DEBUG] org.jsmtpd.core.send.QueueService - Buffer set to 16 messages max for immediate processing 2197 [main][DEBUG] org.jsmtpd.core.send.QueueService - Storage usage 0/1024 (in Mo) 2208 [main][ INFO] org.jsmtpd.core.receive.Receiver - Listening for connections on port 25 2208 [ThreadPoolControl-9][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 2214 [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 1 threads 2261 [ThreadPoolControl-14][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started 2263 [main][ INFO] org.jsmtpd.Controler - Delivery service started 2264 [main][ INFO] org.jsmtpd.Controler - Server running
That's it, Jsmtpd is running. Use Control+C to stop it.
Note that by default, Jsmtpd will try to bind on port 25...and this requires admin rights (uid=0, that's to say to be root). You can change the port in etc/jsmtpd.ini to a >1024 port for testings, but it won't be able to receive mails as smtp default is port 25.
Error message of you try to run it on port 25 while not beeing root :
0 [main][ INFO] org.jsmtpd.Controler - Jsmtpd 0.6a-unstable, Copyright (C) 2005 Jean-Francois Poux - jfp@jsmtpd.org
7 [main][ INFO] org.jsmtpd.Controler - Jsmtpd comes with ABSOLUTELY NO WARRANTY;
10 [main][ INFO] org.jsmtpd.Controler - This is free software, and you are welcome to redistribute it under certain conditions;
11 [main][ INFO] org.jsmtpd.Controler - See the LICENCE file for details
12 [main][ INFO] org.jsmtpd.Controler - Server starting ...
1724 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.dnsServices.DNSJavaResolver, set DnsServers=192.168.10.1
1758 [main][ INFO] org.jsmtpd.Controler - DNS Service plugin loaded : DNSJava resolver plugin for jsmptd
1773 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set RelayedHosts=10.0.0.0/255.255.0.0,127.0.0.1
1776 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.acls.SimpleACL, set ValidUsers=*@localhost,*@yourdomain.com
1778 [main][ INFO] org.jsmtpd.Controler - ACL Service plugin loaded : Simple Acces Control List plugin for jsmtp
1800 [main][DEBUG] org.jsmtpd.config.PluginLoader - [set][c]:class org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter, set MailDir=mailboxes/
1802 [main][ INFO] org.jsmtpd.Controler - Local Delivery Service plugin loaded : UnixMailboxWriter plugin for jsmtpd
1810 [main][ INFO] org.jsmtpd.Controler - Remote Delivery Service plugin loaded : RemoteSmtpSender plugin fort jsmptd
1813 [main][ INFO] org.jsmtpd.Controler - Input IP filter chain loaded
1831 [main][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Starting initial pool of 3 threads
1871 [main][DEBUG] org.jsmtpd.core.send.QueueService - Buffer set to 16 messages max for immediate processing
1874 [main][DEBUG] org.jsmtpd.core.send.QueueService - Storage usage 0/1024 (in Mo)
1884 [ThreadPoolControl-9][ INFO] org.jsmtpd.generic.threadpool.GenericThreadPool - Control thread started
1887 [main][ INFO] org.jsmtpd.Controler - Network Listener is down
java.net.BindException: Permission denied
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:97)
at org.jsmtpd.core.receive.Receiver.<init>(Receiver.java:53)
at org.jsmtpd.Controler.initReceiver(Controler.java:233)
at org.jsmtpd.Controler.startup(Controler.java:83)
at org.jsmtpd.Launcher.main(Launcher.java:38)
1903 [Thread-0][DEBUG] org.jsmtpd.Controler - Shutting down plugin : DNSJava resolver plugin for jsmptd
1904 [Thread-0][ INFO] org.jsmtpd.Controler - Jsmtpd shutdown
Minimal things to configure
Take your favorite text editor and edit etc/jsmtpd.ini. The file holds the basic configuration of jsmtpd. Change the default hostname of your machine :
#host running service localHost=testSmtp.mydomain.com
There are 3 points to setup in order to have a fully configured SMTP server :
- Configure your name servers (it's not Jsmtpd)
- Configure the ACL plugin : Jsmtpd has to determe which domain(s) it handles, and who are his local users. It also tells who is relayed throught the SMTP server.
- Configure delivery plugins : Jsmtpd will give local mails to a delivery system : likely a pop3 or a imap server.
What is a SMTP server
A SMTP server is a mail relay. It can receive mails for your users (by example, if you want to send me a mail jfp@jsmtpd.org, then a smtp server will receive the mail for me.)
You (send mail to jfp@jsmtpd.org) ---> Your ISP SMTP ---(connects to jsmtpd.org server)---> jsmtpd.org server receives the mail for me.
It's also an outgoing mail sender: When you send your mail, your local smtp server will handle the process of delivering the mail for you.
A SMTP does not provide a way to read your mail ! Use a pop3 or imap server.
DNS configuration
You want to receive mail on your new SMTP server ? good. You have to tell the world where is the server receiving mail for your domain. Let's say you bought the domain name : yourdomain.com, and a machine(ip=1.2.3.4) running the smtp server. Create a subname for your machine, an address record : it will point to your machine's ip address
smtp.yourdomain.com -> 1.2.3.4
Now, use a special dns field to declare your smtp servers :
MX: yourdomain.com -> smtp.yourdomain.com
Refer to your service provider for such setup, or your DNS daemon manual. Personnaly, I use bind.
To check your MX configuration is okay, do a simple NS lookup :
nslookup > set q=MX > yourdomain.com (blah blah blah...) yourdomain.com mail exchanger = 10 smtp.yourdomain.com
yourdomain.com has one mail server declared : smtp.yourdomain.com
Now check that smtp.yourdomain.com is reachable :
nslookup > set q=a > smtp.yourdomain.com Name: smtp.yourdomain.com Address: 1.2.3.4 >
At this point, there is a mail server declared, and it can be resolved to an ip address. Remote server can send mail to yourdomain.com.
ACL plugin
Now, it's time to tell Jsmtpd the users/domain it handles. We will use a very simple ACL plugin loading it's config from file to memory. Edit the file etc/jsmtpd-plugin-config.xml. There is an ACL element :
<ACLSetup name="Basic ACL" class="org.jsmtpd.plugins.acls.SimpleACL"> <propertyset name="RelayedHosts" value="10.0.0.0/255.255.0.0,127.0.0.1"/> <propertyset name="ValidUsers" value="*@localhost,*@yourdomain.com"/> </ACLSetup>
It's a plugin, it has a logical name ("Basic ACL"), it's java class is "org.jsmtpd.plugins.acls.SimpleACL". It works as explained before. Inside the plugin declaration, there are two propertyset elements, they configure the plugin.
First interesting element is RelayedHosts?. It tells Jsmtpd it can relay hosts comming from the network(s) specified in the value attribute. Change it to whatever your network requires.
Second element interesting is ValidUsers?. Set a list of user@yourdomain to tell Jsmtpd who are his local users. You can use the * wildcard element to specify the whole domain.
Delivery plugin
As said before, you can't check your mails with a smtp server, Jsmtpd will give local mail to a delivery system, it's the job of the local delivery plugin. On linux, the one of the oldest system used is mailbox delivery. The smtp server writes mails to a file in mbox format, one file per user. A pop or imap daemon reads the file and allows users to get acces to their mailbox remotely. To do so, edit the file etc/jsmtpd-plugin-config.xml, and locate the LocalDeliveryService? element, it looks like :
<LocalDeliveryService name="umw" class="org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter"> <propertyset name="mailDir" value="mailboxes/"/> </LocalDeliveryService>
The default implementation used for local delivery is org.jsmtpd.plugins.deliveryServices.UnixMailboxWriter?, that's the plugin we mentioned before. The mailDir property is the path where mbox files are written. Usually, it's something like /var/mail on unixes. There are others delivery plugins in Jsmtpd : maildir format, LMTP protocol to feed systems like cyrus, or smtp relay to send the mail to other server.
Finished ?
Each time you change configuration, you have to restart Jsmtpd. Take a look at the manual for advanced configuration, or look in this wiki.
