Announcement Announcement Module
Collapse
No announcement yet.
JavaMailSenderImpl : Relaying denied Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment


    • #3
      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.

      Comment


      • #4
        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: <[email protected]>
        rcpt to: <[email protected]>
        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

        Comment


        • #5
          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

          Comment


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

            Comment


            • #7
              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.

              Comment


              • #8
                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

                Comment


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

                  u made an happy man :-)

                  Comment

                  Working...
                  X