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

Discussion in 'Java' started by Luke, Mar 15, 2007.

  1. Luke

    Luke Guest

    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
    () it works and the mail is sent.
    If the "To" field is a domain external address () it
    gives me the error:
    Sending the email to the following server failed : mailserver:25

    How is it possibile?
    any solution?

    thanks
     
    Luke, Mar 15, 2007
    #1
    1. Advertising

  2. On 15 Mar 2007 02:53:29 -0700, Luke wrote:
    > if the "To" field is an internal address of the domain
    > () it works and the mail is sent. If the "To" field is
    > a domain external address () 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

    --
    [ don't email me support questions or followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Mar 15, 2007
    #2
    1. Advertising

  3. Luke

    Nigel Wade Guest

    Luke wrote:

    > 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
    > () it works and the mail is sent.
    > If the "To" field is a domain external address () 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?

    --
    Nigel Wade, System Administrator, Space Plasma Physics Group,
    University of Leicester, Leicester, LE1 7RH, UK
    E-mail :
    Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
     
    Nigel Wade, Mar 15, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RedEye
    Replies:
    2
    Views:
    3,282
    RedEye
    Nov 18, 2003
  2. Replies:
    4
    Views:
    55,490
  3. =?Utf-8?B?T3Bh?=

    Sending Mail via System.Net.Mail problem

    =?Utf-8?B?T3Bh?=, Jan 25, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    3,606
    sachya
    Jan 31, 2006
  4. =?ISO-8859-1?Q?Andr=E9s_Berenguer?=

    Sending e-mail with attachments with the default e-mail client

    =?ISO-8859-1?Q?Andr=E9s_Berenguer?=, Aug 29, 2003, in forum: Java
    Replies:
    0
    Views:
    511
    =?ISO-8859-1?Q?Andr=E9s_Berenguer?=
    Aug 29, 2003
  5. Replies:
    0
    Views:
    1,377
Loading...

Share This Page