Results 1 to 9 of 9

Thread: JavaMailSenderImpl : Relaying denied

Hybrid View

  1. #1

    Default JavaMailSenderImpl : Relaying denied

    Hi,

    I've got a relay denied when send a mail on my production server.

    I write correctly my username, password and host (it works localy).

    What could i forget ?

    Thanks,

    Fabien.

  2. #2
    Join Date
    Sep 2004
    Posts
    2

    Default From: or To:?

    The most likely suspect is that your email is not from or to a user in the same domain as your production server.

    What are you setting the "To:" and "From:" fields of your email to?

  3. #3

    Default

    Hi jazzyjez,

    i use the :

    setRecipient
    setFRom

    with the same @ and the domain of the email is host by the smtp provider.

    Must i set the setTo ?

    Thanks

    Fabien.

  4. #4
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    This is almost certainly not Spring related. It really depends on how relaying permissions are set up on the mail server.

    Most mail servers are set up so that they accept mail sent by anybody, if the recipient is for a 'local' domain. This is not even considered relaying of course, but just local mail delivery. Then they will typically be set up so that for non-local domains, the sender needs to be coming from an IP address that is considered local (the actual declared 'from' address on the mail message is completely irrelevant, and ignored, as it can be faked). Above and beyond that, some mail servers also allow authenticated SMTP, where they allow the client connecting them to authenticate with a username and password, in which case they will allow relaying to any address, for such authenticated clients.

    You may want to just manually test the mail server by telnetting into it:

    > telnet mail.whatever.com 25
    then do the following commands as per the SMTP RFC:

    mail from: <joe@joe.com>
    rcpt to: <some.address@some.domain.com>
    rcpt to: ..... and so on. See if you get refused or not, most mail servers will refuse addresses immediaely after you give the 'rcpt to' command.

    Colin
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  5. #5

    Default

    Hi colin,

    Thanks for the answer, i was thinking that every smtp server allow authentification to post from an IP that is out of the provider range, that's why i was surprised. I know that my post is not very well here sorry for this ! :wink:

    Thanks again and good night,

    Fabien

  6. #6
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    No, I'd be surprised if even 10% of the SMTP servers out there are set up to allow authentication...

  7. #7

    Default Authentificator and Spring

    Hi Colin ,

    Excuse me again, but when i trace the send of my mail in the class JavaMailSenderImpl (send methode) : the session has the authentificator property set as null....

    How to initialize this because the username and password i set in the xml spring is not the real authentification but only the user mail account.

    Thanks,

    Fabien.

  8. #8
    Join Date
    Sep 2004
    Posts
    1

    Default

    Hi fmourioux,
    try this in your appcontext:

    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailS enderImpl">
    <property name="host"><value>smtp.mail.org</value></property>
    <property name="username"><value>joe</value></property>
    <property name="password"><value>abc123</value></property>
    <property name="javaMailProperties">
    <props>
    <prop key="mail.smtp.auth">true</prop>
    </props>
    </property>

    </bean>

    bye,

    Chris

  9. #9

    Default

    Wonderful it works with an authentified smtp server ! Thanks a lot chrisp !

    u made an happy man :-)

Similar Threads

  1. Access is denied (user is not anonymous)
    By matthewramella in forum Security
    Replies: 7
    Last Post: Feb 28th, 2008, 10:02 PM
  2. Null session in JavaMailSenderImpl
    By fherrerav in forum Container
    Replies: 3
    Last Post: Mar 21st, 2007, 01:07 PM
  3. Replies: 3
    Last Post: Mar 10th, 2007, 02:55 PM
  4. Replies: 4
    Last Post: Apr 4th, 2005, 02:28 AM
  5. Relay issue for email and JavamailSenderImpl attributes
    By realfutbol13 in forum Container
    Replies: 1
    Last Post: Dec 23rd, 2004, 10:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •