Thanks a lot, Jakob!

I've done next step, but still have problems:
Sending the message...SessionMailerBean.send: checkpoint 1.
connecting to 192.168.1.2
connected to 192.168.1.2
received : 220 gate.dekasoft.com.ua ESMTP Postfix
sent: HELO alex
received : 250 gate.dekasoft.com.ua
Failed !
Cannot send the message with MailerBean:java.lang.Exception: The message can not be send : error (org.apache.geronimo.javamail.transport.smtp.SMTPTransportExcep
tion: no FROM address)

My configuration is:
<gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
       <attribute name="transportProtocol">smtp</attribute>
       <attribute name="useDefault">false</attribute>
       <attribute name="host">192.168.1.2</attribute>
       <attribute name="properties">
           mail.debug=true
           mail.smtp.port=25
           [EMAIL PROTECTED]
</attribute> </gbean>

It looks like geronimo doesn't pickup mai.from property value from configuration.
I do not like to hardcode it into application.
Thanks!

Best regards,
Alex Andrushchak

Jakob Færch (Trifork) wrote:



Alex Andrushchak wrote:

Ok, i've moved from dead point :-)


Wonderful!

Now i have another problem:
Cannot send the message with MailerBean:java.lang.Exception: The message can not be send : Unable to locate provider for protocol: smtp


The transport for smtp is located in the file geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.

By some odd mistake, it is not included in the tomcat distribution.
If you are using a jetty distribution, the jar file should be there all right in GERONIMO_INSTALL_DIR/repository/geronimo/jars. If you are on a tomcat distribution, I _guess_ you would be fine downloading the jetty distribution and manually copying the jar file from the above directory in the jetty distribution to the same directory in the tomcat distribution - anyone: feel free to correct me on this!

In order to make the smtp transport available to your application, you need to add the following dependency to the application's plan:
<dependency>
    <groupId>geronimo</groupId>
    <artifactId>geronimo-javamail-transport</artifactId>
    <version>1.0</version>
</dependency>


My application configuration is:
<gbean name="protocol.smtp" class="org.apache.geronimo.mail.SMTPTransportGBean">
       <attribute name="host">192.168.1.2</attribute>
       <attribute name="port">25</attribute>
<attribute name="from">[EMAIL PROTECTED]</attribute> </gbean>

<gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
       <attribute name="transportProtocol">smtp</attribute>
       <attribute name="useDefault">true</attribute>
<attribute name="properties">mail.debug=true</attribute> <reference name="Protocols">
           <name>protocol.smtp</name>
       </reference>
   </gbean>


It's not (yet) entirely well documented how to set up the necessary GBeans - to say the least. It seems in the AdventureBuilder (which is able to send mail using the smtp transport and javamail), the following GBean is sufficient:

<gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
        <attribute name="host">${smtpHost}</attribute>
        <attribute name="properties">
        mail.from=${smtpFrom}
        mail.smtp.port=${smtpPort}</attribute>
</gbean>


Note that compared to you configuration, the smtp host and port is on the MailGBean, not the SMTPTransportGBean. I guess things will work with the SMTPTransportGBean configured alongside the MailGBean, but my experience was that the SMTPTransportGBean was not necessary - anyone: correct me on this!

Alex, I hope this helps you; please keep the list updated on your progress.

Jakob


Reply via email to