Results 1 to 4 of 4

Thread: JavaMailSender timeout

  1. #1
    Join Date
    Jun 2005
    Posts
    2

    Default 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. #2
    Join Date
    Jul 2005
    Location
    Idaho
    Posts
    231

    Default

    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

  3. #3
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    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
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  4. #4
    Join Date
    Jun 2005
    Posts
    2

    Default

    that worked

    thanks to all!

    archi

Similar Threads

  1. Replies: 3
    Last Post: Jul 26th, 2010, 09:54 PM
  2. Setting a timeout for HTTP Invokers
    By khill in forum Remoting
    Replies: 5
    Last Post: Sep 10th, 2009, 03:24 PM
  3. Replies: 6
    Last Post: Mar 9th, 2005, 01:08 PM
  4. Session Timeout
    By pperalta in forum Data
    Replies: 2
    Last Post: Nov 15th, 2004, 08:32 AM
  5. Replies: 2
    Last Post: Nov 12th, 2004, 06:17 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
  •