$ telnet localhost 10025 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 localhost.localdomain JAMES SMTP Server Server (JAMES SMTP Server ) ready helo example.com 250 localhost.localdomain Hello example.com [127.0.0.1])
Entries tagged [james]
Posted on Friday Feb 06, 2015 at 04:47PM in Technology
My James instance looks like failed to determine its hostname as follows:
This can be solved by editing XML files such as
imapserver.xml respectively as follows:
Also you should check that the name which James will use during communicate to another SMTP server. you can check it easily with this site. if the name is wrong, this may be a cause of that remote server will consider your James server as spammer. the name to use will be hostname of the server. you can check it with simply issuing
hostname command on Linux.
Unfortunately you can’t set the hostname in portable way due to a bug in a dependency
geronimo-javamail_1.4_mail. the hostname should be able to configured in
mailetcontainer.xml as follows but not worked at the present time.
<!-- Set the HELO/EHLO name to use when connectiong to remote SMTP-Server --> <mail.smtp.localhost>www.nailedtothex.org</mail.smtp.localhost>
geronimo-javamail_1.4_mail ignores that value. considerable solutions are following:
Change the hostname of the server (for <= Java 7u51)
Put you FQDN first (before
/etc/hosts. detail (for recent Java)
Apply a patch to Geronimo JavaMail and update dependency of James. unfortunately seems like that fixed version of Geronimo JavaMail is not released yet.
Posted on Friday Feb 06, 2015 at 03:00PM in Technology
I’m using revision number
1657019 in the SVN trunk of James3. I see an error in
james-server.log at every receiving of emails as follows:
INFO 14:41:51,912 | james.mailetcontext | Error communicating with spamd on localhost:783 Exception: java.net.ConnectException: Connection refused
It seems like that James is trying to connect to local SpamAssassin instance, but I have no SpamAssassin instance on my server yet so I simply deleted following definition from
<mailet notmatch="SenderHostIsLocal" class="SpamAssassin"> <spamdHost>localhost</spamdHost> <spamdPort>783</spamdPort> </mailet>
Now the exception disappeared.
Posted on Friday Feb 06, 2015 at 02:47PM in Technology
I’m using James3 in SVN trunk revision number
Adding a user to recipient rewrite table
This forwards a address
./james-cli.sh -p 9999 -h localhost addaddressmapping postmaster example.com firstname.lastname@example.org
Defining postmaster address
James replaces a particular address
PostmasterAlias according to XML definition on some environment, so we need to set correct email address to it. in
$JAMES_HOME/mailetcontainer.xml as follows:
<mailetcontainer enableJmx="true"> <!-- MailAddress used for PostMaster --> <context> <postmaster>email@example.com</postmaster> </context> ...
Posted on Friday Feb 06, 2015 at 02:30PM in Technology
Put latest Derby jars
derbynet.jar of 10.11.1.1 to accept network connections. put these jars you needed into
Define that jars to wrapper.conf
Comment out following line in
Then put following line:
Make Derby to accept network connections
Add following line to
Also additional system properties are needed:
I prefer to place
$JAMES_HOME/log, and append log to exist one.
Define shutdown hook of Derby
Lob streaming is not supported
Currently OpenJPA, James’s JPA provider, is not supported lob streaming for Derby. James stored mail data in lob so If you frequently use larger mails, consider using other databases instead of Derby.
Posted on Thursday Feb 05, 2015 at 05:16PM in Technology
In previous posting, I set up James as a plain standalone application on OS X. this time I’m going to install James as a service on CentOS 6.6, and expose its SMTP, POP3 and IMAP ports to external network.
Create a user for James
java process of James will run
james user which added in this step.
sudo useradd james
james-server-app-3.0.0-beta5-SNAPSHOT-app.tar.gz which built in previous posting.
sudo tar zxvf james-server-app-3.0.0-beta5-SNAPSHOT-app.tar.gz -C /usr/local --no-same-owner sudo chown -R james:james /usr/local/james-server-app-3.0.0-beta5-SNAPSHOT sudo ln -s /usr/local/james-server-app-3.0.0-beta5-SNAPSHOT /usr/local/james
Change ports that James will listen
Add offset of
bind element in
imapserver.xml respectively as I did in previous posting.
Reduce heap size
Default maximum heap size of James is 512MB but it’s too large for me because I have only small amount of memory on the server so I reduced it to more smaller. this can be done with modifying the file
$JAMES_HOME/conf/wrapper.conf as follows:
Define user to startup script
$JAMES_HOME/bin/james there’s a variable which defines the user to run the process of James. so set it to
james as follows:
Register the startup script
sudo ln -s /usr/local/james/bin/james /etc/init.d sudo chkconfig --add james sudo chkconfig james on
Now we can control James with
service command as follows:
sudo service james start sudo service james stop
Also James will be launched / shutdown automatically at every boot/shutdown process of CentOS.
NOTE on some environment, following error may occur.
$ sudo service james start Starting Apache James :: Server :: App... /usr/local/james-server-app-3.0.0-beta5-SNAPSHOT/bin/james: /usr/local/james-server-app-3.0.0-beta5-SNAPSHOT/bin/./wrapper-linux-x86-32: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory $
According to this discussion, it related to the environment which used in build. then the problem should be fixed with issuing following command:
sudo yum install glibc.i686
Configure port forwarding
This makes SMTP, POP3 and IMAP ports to be forwarded to ports of James listening. this enables us to launch James process as a regular user owning process, not root process. here’s an example of
*nat :PREROUTING ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :POSTROUTING ACCEPT [0:0] -A PREROUTING -i eth0 -p tcp --dport 25 -j DNAT --to-destination :10025 -A PREROUTING -i eth0 -p tcp --dport 110 -j DNAT --to-destination :10110 -A PREROUTING -i eth0 -p tcp --dport 143 -j DNAT --to-destination :10143 COMMIT *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 10025 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 10110 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 10143 -j ACCEPT COMMIT
After update the
/etc/sysconfig/iptables file, restart the iptables serivce as follows:
sudo service iptables restart
Remaining tasks such as registering shutdown hook of Derby, creating domains, users…
NOTE: You should make James to use secured connection
Currently all of communication between the server and client is clear text so any data including credentials can be sniffed. I would try to configure James to use secured connection in another post later.