problem sending mail: Sending the email to the following server failed

L

Luke

Hi
I use this code to send emails:

import org.apache.commons.mail.*;

SimpleEmail email = new SimpleEmail();
email.setFrom(from, "Name");
email.addTo(to);
email.setSubject(oggetto);
email.setHostName("mailserver");
email.setMsg(messaggio);
email.send();

if the "To" field is an internal address of the domain
([email protected]) it works and the mail is sent.
If the "To" field is a domain external address ([email protected]) it
gives me the error:
Sending the email to the following server failed : mailserver:25

How is it possibile?
any solution?

thanks
 
G

Gordon Beaton

if the "To" field is an internal address of the domain
([email protected]) it works and the mail is sent. If the "To" field is
a domain external address ([email protected]) it gives me the error:
Sending the email to the following server failed : mailserver:25

Where is the rest of the code?

What was the complete error message from the mailserver?

What happened when you turned on debugging with setDebug(true)?

Is "mailserver" the name of the outgoing SMTP server for your domain?

Do you need to authenticate with the SMTP server in order to send
outgoing mail?

/gordon
 
N

Nigel Wade

Luke said:
Hi
I use this code to send emails:

import org.apache.commons.mail.*;

SimpleEmail email = new SimpleEmail();
email.setFrom(from, "Name");
email.addTo(to);
email.setSubject(oggetto);
email.setHostName("mailserver");
email.setMsg(messaggio);
email.send();

if the "To" field is an internal address of the domain
([email protected]) it works and the mail is sent.
If the "To" field is a domain external address ([email protected]) it
gives me the error:
Sending the email to the following server failed : mailserver:25

How is it possibile?
any solution?

thanks

Probably because the administrator of that mail server has configured it to
prevent it being used as a relay. Are you supposed to be able to use that mail
server for relaying messages?

What it the error code and message returned?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top