JES and SMTP settings

364 views
Skip to first unread message

Peter Davie

unread,
Jul 24, 2009, 12:02:50 PM7/24/09
to Java Email Server
First off, I want to say, my questions may well be as a result of my
ignorance, but here goes anyway.

I've written a small mailing program in Java that needs to connect to
a SMTP service to send mail.

I've downloaded JES 1.6.1 and it installs beautifully simply. But it
also simply does not work, as far as I can tell.

I've just figured out I'm really using JES to relay SMTP messages, so
I've just setup the domain name in mail.conf.

I've also enabled the relay address (in my case, localhost). Should
that be my actual IP address, or is localhost OK?

I've also setup one e-mail that can relay e-mail.

So having followed the instructions, I still do not seem to be able to
get it to work.

I've created a mailer_daemon account at my (remote) ISP and messages
do not get to it.

Is all this because I'm using localhost? Or have I completely missed
the point of something important?

Apologies for the slightly confused message, but I am confused right
now.
Thanks in advance,
Peter

Peter Davie

unread,
Jul 24, 2009, 12:10:58 PM7/24/09
to Java Email Server
One more thing, I've tried sending a mail via JES to my actual mail
account and I get a 554 error message. On other test mails to
different accounts I get a range of realistic error messages, but I've
not yet seen a 250!

So JES seems to be partially connecting to the remote server, but
something in my configuration is stopping it from working properly.

I then get lots of circular mailing_daemon@* messages going to
mailing_daemon@* and they chase their tails.

I edited mail.conf minimally, I have not added any users to users.conf
and I only changed the reporting level in logs.conf to debug.

Peter Davie

unread,
Jul 26, 2009, 12:53:42 AM7/26/09
to Java Email Server
Here is my mail.conf. As far as I can tell, I've set it up correctly
for mail forwarding. I do not have the specified users in the
users.conf file, since I am assuming that if I do, they will be
treated as local and then no mail will be relayed.

# Java Mail Server Configuration File

# The listen address is the local IP address (or host name) that
# JES will listen for incoming connections on. If this value is
# not set, it will listen on all addresses.
#listen.address=

# The port number to listen for incoming SMTP connection on.
# This value should be set to 25 unless you really know what you are
doing.
smtpport=25

# The port number to listen for incoming POP3 connections on.
# This value should be set to 110 unless you really know what you are
doing.
pop3port=110

# Each service is configured to use a pool of threads to handle
incoming
# connections. This property defines the number of threads allocated
to
# each pool. The number of threads will be the total number of
clients
# each service (SMTP, POP3) can handle at one time.
threads=7

# The server limits the size of incoming emails. The default size is
5 MB.
# This settings is in MegaBytes (MB).
smtp.messagesize=5

# The server stores incoming SMTP messages on disk before attempting
to deliver them. This
# setting determines how often (in seconds) the server checks the disk
for new messages to deliver. The
# smaller the number, the faster message will be processed. However,
a smaller number will cause
# the server to use more of your system's resources.
smtpdelivery.interval=10

# The server picks the messages from the disk in order to deliver
them. If some message
# cannot be delivered to remote SMTP server at that moment, because of
some error, then the message
# will be kept on the disk for later delivery attempt. However server
can't retry delivery
# indefinitely, therefore following config entry will set maximum
number of retries before the server
# gives up on the message and moves it from smtp spool directory to
failed directory.
smtpdelivery.threshold=1

# This property defines the domains that are considered 'local'. In
order
# to receive email for local users, their domain must be defined here.
# multiple domains can be added as a comma seperated list.
# ex: domains=mydomain1.com,mydomain2.com
domains=simplysuccess.net,surame.net

# If an email is received for a user at a local domain, but
# the user does not exist, JES can deliver the email to a 'default'
mailbox.
# To enable this feature, uncomment this property and set it to a
valid username.
#defaultuser=ad...@mydomain.com

# It may be neccessary to configure your SMTP server to deliver all
outgoing
# mail through a gateway SMTP server. This may be the case if your
ISP blocks outgoing
# SMTP connections. This setting allows you to define a single SMTP
server that your server
# will send all remote mail to.
# Optional: add ":PortNumber" after the SMTP server to specify the
port number. ex : smtp.myisp.com:25
# Optional: add "/user:password" to specify a username and password to
the default SMTP server.
# More than one server can be defined in a comma seperated list.
#defaultsmtpservers=smtp.myisp.com
#defaultsmtpservers=smtp.myisp.com:587/mailuser:mailpass

# The following properties configure the rules for relaying SMTP
# mail. If an incoming email message matches any of the rules,
# it will be accepted for relay. If none of the rules match, it
# will be rejected. Be default, all rules are disabled.

# POP before SMTP enables users who check their POP3 account to
# relay mail for a given period of time. When they authenticate
# with the POP3 server, their IP address is added to a 'allow relay'
# list for a given period of time.
#relay.popbeforesmtp=true

# If POP before SMTP is enabled, this value defines the length of time
in minutes
# that the authenticated IP address stays valid. The default value is
10.
#relay.popbeforesmtp.timeout=10

# Individual IP addresses can be specified to allow email to be
relayed.
# This can be useful if you want to provide access to specific
machines or
# sets of machines, including your localhost. Wildcards can be used
# to specify a range of addresses.
# ex: 192.168.*.* allows all addresses that start with 192.168 to
# relay email. Partial wildcards are not allowed. ex: 19*.168.0.1 is
invalid.
# Multiple addresses can be specified as a comma separated list.
relay.ipaddresses=192.168.1.100

# Individual 'from' email addresses can be specified to allow email
# sent from that address to be relayed.
# WARNING: Anyone who knows what email addresses are allowed to relay
# may send email from those addresses, including SPAMers. This should
# be used with caution.
# Multiple email addresses can be specified as a comma separated list.
# Email addresses are case insensitives.
# You can specify a blank username (@domain) to allow a whole domain.
relay.emailaddresses=SOME...@simplysuccess.net

Eric Daugherty

unread,
Jul 26, 2009, 6:14:25 PM7/26/09
to Java Email Server
Couple of things to try. If you are sending emails to users
@simplysuccess.net using JES to relay, you should NOT define them as
local domain. If you do, JES will think it should process the mail
locally, and since you didn't define any local users it will reject
everything. If you are sending FROM @simplysuccess.net, then you'll
get and circular reference when the emails bounce. Try changing the
local name to something illegal (example.org), or blank (I'm not sure
if Blank is legal).

If you are sending locally from the same box, the IP should be
127.0.0.1, if it is another machine on the same network, then I assume
the IP you have is fine.

Eric
> relay.emailaddresses=SOMETH...@simplysuccess.net

Peter Davie

unread,
Jul 27, 2009, 6:36:09 AM7/27/09
to java-ema...@googlegroups.com
Hi Eric,
Thanks for the reply.

I am sending FROM simplysucces.net to other addresses NOT on my machine. I am essentially treating JES as an outbound SMTP service and "outsourcing" the gruntwork of delivering the mail to JES.

On the IP address issue, I am not sending relay messages on the same machine. The IP address is the IP of my machine, but not my Internet connected IP. Should I change the value to my "external" IP address? I would have imagined the network routing tables would do that having worked out the DNS resolution and figured out that all the outbound Mail servers are non-local.

JES certainly seems to connect to them, in part. In the logs, I see that some domains fail because the domain does not exist any longer, which is correct.

I have made the changes you suggested and I now get this error (all the error codes I get are valid SMTP error codes):

2009-07-27 18:33:14,954 - [SMTPSender] SMTPSender - Delivery failed for message from: pe...@simplysuccess.net to: peter...@simplysuccess.net - java.lang.RuntimeException: Error talking to remote Server, code=554
java.lang.RuntimeException: Error talking to remote Server, code=554
        at com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.sendIntro(SMTPRemoteSender.java:271)
        at com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.sendMessage(SMTPRemoteSender.java:122)
        at com.ericdaugherty.mail.server.services.smtp.SMTPSender.deliverRemoteMessage(SMTPSender.java:361)
        at com.ericdaugherty.mail.server.services.smtp.SMTPSender.deliver(SMTPSender.java:184)
        at com.ericdaugherty.mail.server.services.smtp.SMTPSender.run(SMTPSender.java:100)
        at java.lang.Thread.run(Thread.java:636)


Eric Daugherty

unread,
Jul 27, 2009, 11:57:27 AM7/27/09
to Java Email Server
Peter,

Alright, I think I understand. You have an email address at
SimplySuccess.net, but the actual domain is hosted elsewhere. You are
using JES to send your emails from your local environment.

Based on the logs and your last changes, I think the 'relaying'
function of JES is working fine. It does appear to be attempting to
send the mail to our remote server, and the remote server is rejecting
the attempt for some reason. Have you tried to send to a couple of
other (valid) domains? Do you always get the same errors or do some
domains work?

To debug the issue further, could you send a version of your logs with
the output level at DEBUG? I probably need to see the actual commands
sent and responses to determine where the issue is. The 554 error is
somewhat general, so it would be useful to know at what point it
fails.

Eric

On Jul 27, 5:36 am, Peter Davie <peter.davi...@gmail.com> wrote:
> Hi Eric,
> Thanks for the reply.
>
> I am sending FROM simplysucces.net to other addresses NOT on my machine. I
> am essentially treating JES as an outbound SMTP service and "outsourcing"
> the gruntwork of delivering the mail to JES.
>
> On the IP address issue, I am not sending relay messages on the same
> machine. The IP address is the IP of my machine, but not my Internet
> connected IP. Should I change the value to my "external" IP address? I would
> have imagined the network routing tables would do that having worked out the
> DNS resolution and figured out that all the outbound Mail servers are
> non-local.
>
> JES certainly seems to connect to them, in part. In the logs, I see that
> some domains fail because the domain does not exist any longer, which is
> correct.
>
> I have made the changes you suggested and I now get this error (all the
> error codes I get are valid SMTP error codes):
>
> 2009-07-27 18:33:14,954 - [SMTPSender] SMTPSender - Delivery failed for
> message from: pe...@simplysuccess.net to: peter.da...@simplysuccess.net -
> java.lang.RuntimeException: Error talking to remote Server, code=554
> java.lang.RuntimeException: Error talking to remote Server, code=554
>         at
> com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.sendIntro(SMTP RemoteSender.java:271)
>         at
> com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.sendMessage(SM TPRemoteSender.java:122)
>         at
> com.ericdaugherty.mail.server.services.smtp.SMTPSender.deliverRemoteMessage (SMTPSender.java:361)
>         at
> com.ericdaugherty.mail.server.services.smtp.SMTPSender.deliver(SMTPSender.j ava:184)

Peter Davie

unread,
Jul 29, 2009, 9:03:26 AM7/29/09
to Java Email Server
Hi Eric,
The issue is solved. It was the IP address and some of the other
settings changes you mentioned.

I now appear to have it working. SMTP logs confirm "conversations"
with remote SMTP servers.

Thanks a great deal for your support.
Peter
Reply all
Reply to author
Forward
0 new messages