Announcement Announcement Module
Collapse
No announcement yet.
JavaMailSender timeout Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JavaMailSender timeout

    hello,

    I am sending mails via the JavaMailSender interface, and i would like to set a timeout property if the smtp server is not responding.
    Is there a way to set this in the bean definition in the context.xml or somewhere else?

    <bean id="mailSender"
    class="org.springframework.mail.javamail.JavaMailS enderImpl">
    <property name="host"><value>...</value></property>
    </bean>


    thx in advance

  • #2
    Archi,

    Try and change your bean def. to:

    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailS enderImpl">
    <property name="host"><value>...</value></property>

    <property name="javaMailProperties">
    <props>
    <prop key="mail.pop3.connectiontimeout">30000</prop>
    </props>
    </property>

    </bean>
    Or maybe <prop key="mail.pop3.timeout">30000</prop>

    Hope that helps,

    Steve

    Comment


    • #3
      Archi,

      As Steve says, to control timeout you need to pass in a JavaMail environment parameter to the JavaMailSender which is then passed on to the underlying JavaMail Session. To control SMTP connection timeout you need the mail.smtp.connectiontimeout parameter.

      See Sun's SMTP Docs for a full list of SMTP configuration parameters.

      Rob

      Comment


      • #4
        that worked

        thanks to all!

        archi

        Comment

        Working...
        X