$ 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])
Configuring helo names of James
TweetPosted 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 smtpserver.xml
, pop3server.xml
and imapserver.xml
respectively as follows:
<helloName autodetect="false">www.nailedtothex.org</helloName>
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>
So current 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
localhost
) in/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.
Tags: james
Disabling SpamAssassin on James
TweetPosted 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 mailetcontainer.xml
.
<mailet notmatch="SenderHostIsLocal" class="SpamAssassin"> <spamdHost>localhost</spamdHost> <spamdPort>783</spamdPort> </mailet>
Now the exception disappeared.
Tags: james
Defining aliases on James
TweetPosted on Friday Feb 06, 2015 at 02:47PM in Technology
I’m using James3 in SVN trunk revision number 1657019
.
Adding a user to recipient rewrite table
This forwards a address postmaster@example.com
to kyle@example.com
:
./james-cli.sh -p 9999 -h localhost addaddressmapping postmaster example.com kyle@example.com
Defining postmaster address
James replaces a particular address postmaster
by 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>kyle@example.com</postmaster> </context> ...
Tags: james
Updating and Configuring Derby shipped with James
TweetPosted on Friday Feb 06, 2015 at 02:30PM in Technology
Put latest Derby jars
I used derby.jar
and derbynet.jar
of 10.11.1.1 to accept network connections. put these jars you needed into $JAMES_HOME/lib
.
Define that jars to wrapper.conf
Comment out following line in $JAMES_HOME/conf/wrapper.conf
:
#wrapper.java.classpath.94=%REPO_DIR%/derby-10.9.1.0.jar
Then put following line:
wrapper.java.classpath.94=%REPO_DIR%/derby.jar
Make Derby to accept network connections
Add following line to $JAMES_HOME/conf/wrapper.conf
.
wrapper.java.classpath.131=%REPO_DIR%/derbynet.jar
Also additional system properties are needed:
wrapper.java.additional.15=-Dderby.drda.startNetworkServer=true wrapper.java.additional.16=-Dderby.drda.portNumber=11527
Config derby.log
I prefer to place derby.log
into $JAMES_HOME/log
, and append log to exist one.
wrapper.java.additional.17=-Dderby.stream.error.file=../log/derby.log wrapper.java.additional.18=-Dderby.infolog.append=true
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.
Profiling remote JVM over SSH with VisualVM
TweetPosted on Friday Feb 06, 2015 at 01:31PM in Technology
UPDATE October 2015: This procedure requires a VisualVM distribution that can be obtained from https://visualvm.java.net . At least, It will work with VisualVM 1.3.8. May doesn’t work with VisualVM which has been installed as a part of JDK distribution. I have experienced VisualVM which comes with JDK8u60 doesn’t work.
First I tried that creating a tunnel like ssh remote.example.org -L 19999:localhost:9999
and connecting VisualVM to localhost:19999
, but it didn’t worked. intead, creating a socks tunnel like ssh remote.example.com -D 1080
and connecting VisualVM to localhost:9999
via socks proxy is worked. detailed procedure is following:
-
Create ssh socks tunnel
-
Set manual proxy in VisualVM’s preferences
-
Right-click
Local
-
Add JMX connection
-
Enter
localhost:9999
to text box -
Click
OK
-
Double-click newly added JMX icon
Make sure that destination JVM has started with following system properties:
-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false