0 Replies Latest reply on Nov 4, 2009 10:08 PM by onur

    Problem sending email with glassfishv2

    onur
      Hi all,
      i'm trying to send email with my seam aplication on glassfish v2 but i am getting this exception:


      + SEVERE: javax.faces.FacesException: Could not connect to SMTP host: smtp.gmail.com, port: 25
      javax.faces.el.EvaluationException: javax.faces.FacesException: Could not connect to SMTP host: smtp.gmail.com, port: 25
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
      ....
      Caused by: javax.faces.FacesException: Could not connect to SMTP host: smtp.gmail.com, port: 25
      ....
      Caused by: java.net.ConnectException: Connection timed out: connect
      ...

      why system is trying yo connect smtp with 25 how can i solve this problem?

      i created my project with seam-gen and

      my configurations and xhtml is:

      _in my component.xml:_
      ...
      <mail:mail-session session-jndi-name="java:comp/env/mail/local"
                host="smtp.gmail.com" port="587" username="onurdogan85@gmail.com"
                password="mypassword" />
      ...
      _in my web.xml_:
      ...
      <resource-ref>
              <res-ref-name>mail/local</res-ref-name>
              <res-type>javax.mail.Session</res-type>
              <res-auth>Container</res-auth>
          </resource-ref>
      ....
      _my mail session created with glassfish's admin console and domain.xml is:_
      ...
      - <mail-resource debug="false" enabled="true" from="onurdogan85@gmail.com" host="smtp.gmail.com" jndi-name="mail/local" object-type="user" store-protocol="imap" store-protocol-class="com.sun.mail.imap.IMAPStore" transport-protocol="smtp" transport-protocol-class="com.sun.mail.smtp.SMTPTransport" user="onurdogan85@gmail.com">
        <description>no reply for this mail</description>
        <property name="mail-smtps-host" value="smtp.gmail.com" />
        <property name="mail-smtps-password" value="mypassword" />
        <property name="mail-smtps-socketFactory-class" value="javax.net.ssl.SSLSocketFactory" />
        <property name="mail-smtps-auth" value="true" />
        <property name="mail-smtps-socketFactory-port" value="465" />
        <property name="mail-smtps-port" value="465" />
        <property name="mail-smtps-user" value="onurdogan85@gmail.com" />
        <property name="mail-smtps-starttls-enable" value="true" />
        <property name="mail-smtps-socketFactory-fallback" value="false" />
        </mail-resource>
      ....

      _and my java bean:_

      @Name("registrationMailer")
      public class RegistrationMailer{

           @In
           private Renderer renderer;

           public void sendWelcomeEmail() {
                renderer.render("/deneme.xhtml");
           }
      }

      _and my xhtml:_

      <m:message xmlns="http://www.w3.org/1999/xhtml"
      xmlns:m="http://jboss.com/products/seam/mail"
      xmlns:f="http://java.sun.com/jsf/core"
      importance="normal">
      <m:header name="X-Composed-By" value="JBoss Seam"/>
      <m:from name="test" address="onurdogan85@gmail.com"/>
      <m:replyTo address="onurdogan85@gmail.com"/>

      <m:to name="onur">onurdogan85@gmail.com</m:to>
      <m:subject>test</m:subject>
           
      <m:body>
      <html>
      <body>
      <p>test</p>
      <p><b>Welcome to the
      community!</b></p>
      ...
      </body>
      </html>
      <f:facet name="alternative">test
      Welcome to the seam community!
      ...
      </f:facet>
      </m:body>
      </m:message>
      ...

      i need some help to solve my problem

      what is my mistake?

      thank you in advance...