EMail Servlet

Hello,
          we have problems with an EMail Servlet.
          The server always throws a :
          javax.mail.NoSuchProviderException: No provider for adress type: rfc822
          We use the SMTP protocol. We try to forward an EMail.
          On our server in the DOS-Shell the test passes. But with Weblogic we get
          the error message.........
          Any ideas about that?
          Thanks in advance
          Armin
          

They forgot to include the providers in the weblogicaux.jar. Get
          the mail.jar from javasoft and put it in the weblogic classpath prior
          to the weblogic stuff.
          DreamNEON wrote:
          >
          > Hello,
          >
          > we have problems with an EMail Servlet.
          > The server always throws a :
          > javax.mail.NoSuchProviderException: No provider for adress type: rfc822
          >
          > We use the SMTP protocol. We try to forward an EMail.
          > On our server in the DOS-Shell the test passes. But with Weblogic we get
          > the error message.........
          >
          > Any ideas about that?
          >
          > Thanks in advance
          >
          > Armin
          [bryon.vcf]
          

Similar Messages

  • Converting emails to servlet requests; servlet responses to emails

    Hello,
    I had asked this question in the Servlet forum. They directed me to here.
    I've some servlet applications that posted by HTML forms with file attachements and other HTML fields.
    I want to add email support to my servlets. So, users should be able post and recieve their data by emails.
    But, I don't want to add email handling tasks to the current servlet applications. I need a middleware application between end users and my servlets that converts emails to servlet requests, and servlet responses to emails.
    Here are the steps:
    1- End user sends email with attachments.
    2- Emailed data is converted to servlet request by a middleware application.
    3- Servlet request is processed by my current servlets.
    4- Servlet response is sent to middleware application.
    5- Middleware application emails servlet reponse to end user as email.
    If I can do that, I will not have to add emailing codes to my current servlets. do you know a product doing that ? Or, can you give me a direction ?
    thanks...

    Have you looked into JMS?

  • In JDeveloper10 DataSourceName modifying automatically why?

    The src code is migrated from Oracle JDeveloper 9.0.5.13 to Oracle IDE     10.1.3.36.73
    The Same applicaiton is working for Oracle JDeveloper 9.0.5.13 Version but not for Oracle IDE 10.1.3.36.73
    I found that the DataSource Name is changing "jdbc/SmartSaveDataSourceCoreDS" to jdbc/SmartSaveDataSourceCoreDSDS
    I am using Oracle IDE     10.1.3.36.73
    My Application's Datasource name is configured through Connection Navigator
    Then the tool is generated
    In procurehere-data-sources.xml
    My Data Source Name is: jdbc/SmartSaveDataSourceCoreDS
    But the IDE generated something like below
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <data-sources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema http://xmlns.oracle.com/oracleas/schema/data-sources-10_1.xsd" version="10.1" xmlns="http://xmlns.oracle.com/oracleas/schema">
    <connection-pool name="jdev-connection-pool-SmartSaveDataSourceCoreDS">
         <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="procurefinal" password="->DataBase_User_CEHT0ivhD2sez56FFrkaOjxQUsvaMLyGV0fAv-qphE0=" url="jdbc:oracle:thin:@192.168.1.223:1521:ORADB"/>
    </connection-pool>
    <managed-data-source name="jdev-connection-managed-SmartSaveDataSourceCoreDS" jndi-name="jdbc/SmartSaveDataSourceCoreDSDS" connection-pool-name="jdev-connection-pool-SmartSaveDataSourceCoreDS"/>
    <native-data-source name="jdev-connection-native-SmartSaveDataSourceCoreDS" jndi-name="jdbc/SmartSaveDataSourceCoreDSCoreDS" url="jdbc:oracle:thin:@192.168.1.223:1521:ORADB" user="procurefinal" password="->DataBase_User_nSZOmv35L8n9t6GTioCHg9tx49kHv0wztCQMk-OMNP4=" data-source-class="oracle.jdbc.pool.OracleDataSource"/>
    </data-sources>
    So I am getting an error as
    **** WARNING: The following J2EE projects each have an output directory named 'classes':
    D:\jdev_projects_etc\procurehere.net\Model\Model.jpr
    D:\jdev_projects_etc\procurehere.net\ViewController\ViewController.jpr
    **** WARNING: The collision in output directory names may cause problems in the current version of OC4J.
    **** WARNING: Please see the JDeveloper release notes for details (2591173).
    **** Unable to obtain password from principals.xml. Using default.
    **** Unable to obtain password from principals.xml. Using default.
    D:\j2sdk1.4.2_12\bin\javaw.exe -jar D:\jdev_projects_etc\jdevstudio1013\j2ee\home\admin.jar ormi://192.168.1.155:23891 oc4jadmin **** -updateConfig
    Dec 7, 2006 9:52:11 AM com.oracle.corba.ee.impl.orb.ORBServerExtensionProviderImpl preInitApplicationServer
    WARNING: ORB ignoring configuration changes. Restart OC4J to apply new ORB configuration.
    06/12/07 09:52:11 WARNING: EJBPackage.parseOrionBean Bean InventoryEJB does not exist; skipping deployment
    Dec 7, 2006 9:52:11 AM com.evermind.server.ejb.deployment.EJBPackage parseOrionBean
    WARNING: Bean InventoryEJB does not exist; skipping deployment
    2006-12-07 09:52:12.234 WARNING J2EE EJB3001 [current-workspace-app:procurehere_ViewController_1] EJB module contains no beans.
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 13250 ms.
    Target URL -- http://192.168.1.155:8988/smartsave/index.jsp
    Dec 7, 2006 9:52:19 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:19 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    06/12/07 09:52:20 *******************Email Servlet init method called*******************
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
    06/12/07 09:52:20      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    06/12/07 09:52:20      at java.lang.Thread.run(Thread.java:534)
    06/12/07 09:52:20 cache : {}
    06/12/07 09:52:20 com.procurehere.smartsave.enterprise.global.util.ServiceLocatorEJB's getDataSource(String dataSourceName) : dataSourceName : jdbc/SmartSaveDataSourceCoreDS
    06/12/07 09:52:20 javax.naming.NameNotFoundException: jdbc/SmartSaveDataSourceCoreDS not found
    06/12/07 09:52:20      at com.evermind.server.rmi.RMIServerContext.lookup(RMIServerContext.java:202)
    06/12/07 09:52:20      at com.evermind.server.ApplicationContext.unprivileged_lookup(ApplicationContext.java:259)
    06/12/07 09:52:20      at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:199)
    06/12/07 09:52:20      at javax.naming.InitialContext.lookup(InitialContext.java:347)
    06/12/07 09:52:20      at com.procurehere.smartsave.enterprise.global.util.ServiceLocatorEJB.getDataSource(ServiceLocatorEJB.java:124)
    06/12/07 09:52:20      at com.procurehere.smartsave.enterprise.email.dao.EmailSenderDAOImpl.<init>(EmailSenderDAOImpl.java:70)
    06/12/07 09:52:20      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    06/12/07 09:52:20      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    06/12/07 09:52:20      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    06/12/07 09:52:20      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    06/12/07 09:52:20      at java.lang.Class.newInstance0(Class.java:308)
    06/12/07 09:52:20      at java.lang.Class.newInstance(Class.java:261)
    06/12/07 09:52:20      at com.procurehere.smartsave.enterprise.global.util.ServiceLocatorWEB.getDAO(ServiceLocatorWEB.java:191)
    06/12/07 09:52:20      at com.procurehere.smartsave.web.services.emailservice.EmailService.<init>(EmailService.java:62)
    06/12/07 09:52:20      at com.procurehere.smartsave.web.services.emailservice.EmailService.<clinit>(EmailService.java:51)
    06/12/07 09:52:20      at com.procurehere.smartsave.web.services.servlets.EmailServiceServlet.init(EmailServiceServlet.java:39)
    06/12/07 09:52:20      at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2231)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4617)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4541)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4730)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1019)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:649)
    06/12/07 09:52:20      at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:428)
    06/12/07 09:52:20      at com.evermind.server.Application.getHttpApplication(Application.java:512)
    06/12/07 09:52:20      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1975)
    06/12/07 09:52:20      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1958)
    06/12/07 09:52:20      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.getHttpApplication(HttpSite.java:1910)
    06/12/07 09:52:20      at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:427)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.resolveApplication(HttpRequestHandler.java:395)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:437)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    06/12/07 09:52:20 *******************EmailService startSmartSaveService method called*******************
    06/12/07 09:52:20 *******************Escalation Servlet init method called*******************
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
    06/12/07 09:52:20      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    06/12/07 09:52:20      at java.lang.Thread.run(Thread.java:534)
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.bean.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Pls give me solution
    Thanks in advance
    MallaReddy

    The src code is migrated from Oracle JDeveloper 9.0.5.13 to Oracle IDE     10.1.3.36.73
    The Same applicaiton is working for Oracle JDeveloper 9.0.5.13 Version but not for Oracle IDE 10.1.3.36.73
    I found that the DataSource Name is changing "jdbc/SmartSaveDataSourceCoreDS" to jdbc/SmartSaveDataSourceCoreDSDS
    I am using Oracle IDE     10.1.3.36.73
    My Application's Datasource name is configured through Connection Navigator
    Then the tool is generated
    In procurehere-data-sources.xml
    My Data Source Name is: jdbc/SmartSaveDataSourceCoreDS
    But the IDE generated something like below
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <data-sources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema http://xmlns.oracle.com/oracleas/schema/data-sources-10_1.xsd" version="10.1" xmlns="http://xmlns.oracle.com/oracleas/schema">
    <connection-pool name="jdev-connection-pool-SmartSaveDataSourceCoreDS">
         <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="procurefinal" password="->DataBase_User_CEHT0ivhD2sez56FFrkaOjxQUsvaMLyGV0fAv-qphE0=" url="jdbc:oracle:thin:@192.168.1.223:1521:ORADB"/>
    </connection-pool>
    <managed-data-source name="jdev-connection-managed-SmartSaveDataSourceCoreDS" jndi-name="jdbc/SmartSaveDataSourceCoreDSDS" connection-pool-name="jdev-connection-pool-SmartSaveDataSourceCoreDS"/>
    <native-data-source name="jdev-connection-native-SmartSaveDataSourceCoreDS" jndi-name="jdbc/SmartSaveDataSourceCoreDSCoreDS" url="jdbc:oracle:thin:@192.168.1.223:1521:ORADB" user="procurefinal" password="->DataBase_User_nSZOmv35L8n9t6GTioCHg9tx49kHv0wztCQMk-OMNP4=" data-source-class="oracle.jdbc.pool.OracleDataSource"/>
    </data-sources>
    So I am getting an error as
    **** WARNING: The following J2EE projects each have an output directory named 'classes':
    D:\jdev_projects_etc\procurehere.net\Model\Model.jpr
    D:\jdev_projects_etc\procurehere.net\ViewController\ViewController.jpr
    **** WARNING: The collision in output directory names may cause problems in the current version of OC4J.
    **** WARNING: Please see the JDeveloper release notes for details (2591173).
    **** Unable to obtain password from principals.xml. Using default.
    **** Unable to obtain password from principals.xml. Using default.
    D:\j2sdk1.4.2_12\bin\javaw.exe -jar D:\jdev_projects_etc\jdevstudio1013\j2ee\home\admin.jar ormi://192.168.1.155:23891 oc4jadmin **** -updateConfig
    Dec 7, 2006 9:52:11 AM com.oracle.corba.ee.impl.orb.ORBServerExtensionProviderImpl preInitApplicationServer
    WARNING: ORB ignoring configuration changes. Restart OC4J to apply new ORB configuration.
    06/12/07 09:52:11 WARNING: EJBPackage.parseOrionBean Bean InventoryEJB does not exist; skipping deployment
    Dec 7, 2006 9:52:11 AM com.evermind.server.ejb.deployment.EJBPackage parseOrionBean
    WARNING: Bean InventoryEJB does not exist; skipping deployment
    2006-12-07 09:52:12.234 WARNING J2EE EJB3001 [current-workspace-app:procurehere_ViewController_1] EJB module contains no beans.
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 13250 ms.
    Target URL -- http://192.168.1.155:8988/smartsave/index.jsp
    Dec 7, 2006 9:52:19 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:19 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    06/12/07 09:52:20 *******************Email Servlet init method called*******************
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
    06/12/07 09:52:20      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    06/12/07 09:52:20      at java.lang.Thread.run(Thread.java:534)
    06/12/07 09:52:20 cache : {}
    06/12/07 09:52:20 com.procurehere.smartsave.enterprise.global.util.ServiceLocatorEJB's getDataSource(String dataSourceName) : dataSourceName : jdbc/SmartSaveDataSourceCoreDS
    06/12/07 09:52:20 javax.naming.NameNotFoundException: jdbc/SmartSaveDataSourceCoreDS not found
    06/12/07 09:52:20      at com.evermind.server.rmi.RMIServerContext.lookup(RMIServerContext.java:202)
    06/12/07 09:52:20      at com.evermind.server.ApplicationContext.unprivileged_lookup(ApplicationContext.java:259)
    06/12/07 09:52:20      at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:199)
    06/12/07 09:52:20      at javax.naming.InitialContext.lookup(InitialContext.java:347)
    06/12/07 09:52:20      at com.procurehere.smartsave.enterprise.global.util.ServiceLocatorEJB.getDataSource(ServiceLocatorEJB.java:124)
    06/12/07 09:52:20      at com.procurehere.smartsave.enterprise.email.dao.EmailSenderDAOImpl.<init>(EmailSenderDAOImpl.java:70)
    06/12/07 09:52:20      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    06/12/07 09:52:20      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    06/12/07 09:52:20      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    06/12/07 09:52:20      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    06/12/07 09:52:20      at java.lang.Class.newInstance0(Class.java:308)
    06/12/07 09:52:20      at java.lang.Class.newInstance(Class.java:261)
    06/12/07 09:52:20      at com.procurehere.smartsave.enterprise.global.util.ServiceLocatorWEB.getDAO(ServiceLocatorWEB.java:191)
    06/12/07 09:52:20      at com.procurehere.smartsave.web.services.emailservice.EmailService.<init>(EmailService.java:62)
    06/12/07 09:52:20      at com.procurehere.smartsave.web.services.emailservice.EmailService.<clinit>(EmailService.java:51)
    06/12/07 09:52:20      at com.procurehere.smartsave.web.services.servlets.EmailServiceServlet.init(EmailServiceServlet.java:39)
    06/12/07 09:52:20      at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2231)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4617)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4541)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4730)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1019)
    06/12/07 09:52:20      at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:649)
    06/12/07 09:52:20      at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:428)
    06/12/07 09:52:20      at com.evermind.server.Application.getHttpApplication(Application.java:512)
    06/12/07 09:52:20      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1975)
    06/12/07 09:52:20      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1958)
    06/12/07 09:52:20      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.getHttpApplication(HttpSite.java:1910)
    06/12/07 09:52:20      at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:427)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.resolveApplication(HttpRequestHandler.java:395)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:437)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
    06/12/07 09:52:20      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    06/12/07 09:52:20 *******************EmailService startSmartSaveService method called*******************
    06/12/07 09:52:20 *******************Escalation Servlet init method called*******************
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
    06/12/07 09:52:20      at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
    06/12/07 09:52:20      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    06/12/07 09:52:20      at java.lang.Thread.run(Thread.java:534)
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.bean.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 7, 2006 9:52:20 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Pls give me solution
    Thanks in advance
    MallaReddy

  • Send email from j2me through servlet

    Hi people,
    i hope you can help me because i am new in network programming.
    I am trying to send email from j2me to googlemail account I have 2 classes EmailMidlet (which has been tested with wireless Toolkit 2.5.2 and it works) and the second class is the servlet-class named EmailServlet:
    when i call the EmailServlet, i get on the console:
    Server: 220 mx.google.com ESMTP g28sm19313024fkg.21
    Server: 250 mx.google.com at your service
    this is the code of my EmailServlet
    import java.io.*;
    import java.net.Socket;
    import java.net.UnknownHostException;
    import java.text.*;
    import java.util.Date;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class EmailServlet extends HttpServlet {
       public void doPost(HttpServletRequest request, HttpServletResponse response)
             throws IOException, ServletException {
          System.out.println("____emailservlet.doPost");
          response.setContentType("text/plain");
          PrintWriter out = response.getWriter();
          System.out.println("______________________________");
          out.println();
          String to = request.getParameter("to");
          System.out.println("____________________________to" + to);
          String subject = request.getParameter("subject");
          String msg = request.getParameter("msg");
          // construct an instance of EmailSender
          System.out.println("servlet_to" + to);
          send("[email protected]", to, subject, msg);
          out.println("mail sent....");
       public void send(String from, String to, String subject, String msg) {
          Socket smtpSocket = null;
          DataOutputStream os = null;
          DataInputStream is = null;
          try {
             smtpSocket = new Socket("smtp.googlemail.com", 25);
             os = new DataOutputStream(smtpSocket.getOutputStream());
             is = new DataInputStream(smtpSocket.getInputStream());
          } catch (UnknownHostException e) {
             System.err.println("Don't know about host: hostname");
          } catch (IOException e) {
             System.err
                   .println("Couldn't get I/O for the connection to: hostname");
          if (smtpSocket != null && os != null && is != null) {
             try {
                os.writeBytes("HELO there" + "\r\n");
                os.writeBytes("MAIL FROM: " + from + "\r\n");
                os.writeBytes("RCPT TO: " + to + "\r\n");
                os.writeBytes("DATA\r\n");
                os.writeBytes("Date: " + new Date() + "\r\n"); // stamp the msg
                                                    // with date
                os.writeBytes("From: " + from + "\r\n");
                os.writeBytes("To: " + to + "\r\n");
                os.writeBytes("Subject: " + subject + "\r\n");
                os.writeBytes(msg + "\r\n"); // message body
                os.writeBytes(".\r\n");
                os.writeBytes("QUIT\r\n");
                // debugging
                String responseLine;
                while ((responseLine = is.readLine()) != null) {
                   System.out.println("Server: " + responseLine);
                   if (responseLine.indexOf("delivery") != -1) {
                      break;
                os.close();
                is.close();
                smtpSocket.close();
             } catch (UnknownHostException e) {
                System.err.println("Trying to connect to unknown host: " + e);
             } catch (IOException e) {
                System.err.println("IOException: " + e);
       } 1.when i print "to" in EmailServlet also:
      String to = request.getParameter("to");
          System.out.println("____________________________to" + to);  it show null on the console :confused:
    2. ist this right in case of googlemail.com?
      smtpSocket = new Socket("smtp.googlemail.com", 25);  I would be very grateful if somebody can help me.

    jackofall
    Please don't post in old threads that are long dead. When you have a question, please start a topic of your own. Feel free to provide a link to an old thread if relevant.
    I'm locking this thread now.
    db

  • Sending an email from a servlet

    Hi Guys,
    Im trying to send an email from a servlet. I am using the following code:
    IMPORTING LIBRARIES
    import java.util.*;
    import java.io.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    //importing JDBC
    import java.sql.*;
    //email
    import java.net.*;
    import java.text.*; // Used for date formatting.
    BEGIN CLASS
    public class Email3 extends HttpServlet
         private Socket smtpSocket = null;
         private DataOutputStream os = null;
         private DataInputStream is = null;
    public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    PrintWriter out = res.getWriter();
    OUTPUT TAGS FOR WEBPAGE
         out.println("<html>");
    out.println("<head>");
    out.println("<title>FYP</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<center>");
    send email
              //Date dDate = new Date();
              //DateFormat dFormat = _
         //DateFormat.getDateInstance(DateFormat.FULL,Locale.US);
         String m_sHostName="localhost";
         int m_iPort=25;
              try
              { // Open port to server
                   smtpSocket = new Socket(m_sHostName, m_iPort);
                   os = new DataOutputStream(smtpSocket.getOutputStream());
                   is = new DataInputStream(smtpSocket.getInputStream());
                   if(smtpSocket != null && os != null && is != null)
                   { // Connection was made.  Socket is ready for use.
                        out.println("Connection was made. Socket is ready for use.");
                        //[ Code to send email will be placed in here. ]
                        try
                             {   os.writeBytes("HELLO\r\n");
                             // You will add the email address that the server
                             // you are using know you as.
                             os.writeBytes("MAIL From: <[email protected]>\r\n");
                             // Who the email is going to.
                             os.writeBytes("RCPT To: <[email protected]>\r\n");
                             //IF you want to send a CC then you will have to add this
                             os.writeBytes("RCPT Cc: <[email protected]>\r\n");
                             // Now we are ready to add the message and the
                             // header of the email to be sent out.
                             os.writeBytes("DATA\r\n");
                             os.writeBytes("X-Mailer: Via Java\r\n");
                             //os.writeBytes("DATE: " + dFormat.format(dDate) + "\r\n");
                             os.writeBytes("From: Me <[email protected]>\r\n");
                             os.writeBytes("To: YOU <[email protected]>\r\n");
                             //Again if you want to send a CC then add this.
                             os.writeBytes("Cc: CCDUDE <[email protected]>\r\n");
                             //Here you can now add a BCC to the message as well
                             //os.writeBytes("RCPT Bcc: BCCDude<[email protected]>\r\n");
                             String sMessage = "Your subjectline.";
                             os.writeBytes("Subject: Your subjectline here\r\n");
                             os.writeBytes(sMessage + "\r\n");
                             os.writeBytes("\r\n.\r\n");
                             os.writeBytes("QUIT\r\n");
                             // Now send the email off and check the server reply.
                             // Was an OK is reached you are complete.
                             String responseline;
                             while((responseline = is.readLine())!=null)
                             {  // System.out.println(responseline);
                             out.println("responseline= "+responseline+"<br>");
                             if(responseline.indexOf("Ok") != -1)
                                  //out.println("responseline"+responseline);
                             break;
                             catch(Exception e)
                             {  System.out.println("Cannot send email as an error occurred.");
                                  out.println("Cannot send email as an error occurred.");
              catch(Exception e)
              { System.out.println("Host " + m_sHostName + "unknown"); }
              out.println("</center>");
              out.println("</body>");
              out.println("</html>");
              out.close();
    }//end class
    it compiles fine, the connection was made ok but im not receiving the email. When the email is sent off the server reply does not seem to be Ok, as the print statement i tried there is not being executed. When i print the content of my responseline= variable before the if statement i get the following:
    Connection was made. Socket is ready for use. responseline= 220 centaur.elec.qmul.ac.uk ESMTP Exim 3.16 #2 Thu, 09 Jan 2003 15:54:34 +0000
    responseline= 500 Command unrecognized
    responseline= 250 is syntactically correct
    responseline= 550 relaying to prohibited by administrator
    responseline= 500 Command unrecognized
    responseline= 503 No recipient(s).
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 221 Closing connection. Good bye.
    Can anyone help?
    Is there an easier way to send an email from a servlet?
    Thanks
    tzaf

    It's not a matter of "easier way" to send mail from servlet...you are missing a crucial element in your code: authorization to send mail. You need something like this (some of which you have already so note what is different):
            Properties properties = new Properties();
            properties.put("mail.smtp.host", String3 );
            properties.put("mail.smtp.dsn.notify", "SUCCESS" );
            properties.put("mail.smtp.host", "mailservernamegoeshere");
            properties.put("mail.smtp.auth", "true");
            MyAuthenticator auth = new MyAuthenticator();
            auth.setUser("user whos account you want to use goes here");
            auth.setPassword("user password goes here");
            Session session = Session.getDefaultInstance( properties,auth );Here is the auth class:
    class MyAuthenticator extends Authenticator {
       protected String m_strUser     = null;
       protected String m_strPassword = null;
       protected PasswordAuthentication getPasswordAuthentication()  {
          return new PasswordAuthentication(m_strUser,m_strPassword);
       public void setUser(String strUser)  {
          m_strUser = strUser;
       public void setPassword(String strPassword)  {
          m_strPassword = strPassword;

  • Send(email)  method  is delaying servlet's response

    hello ,
    i have a servlet that store a message in the DB ,
    after the message was stored ,
    a requestDispatcher is called to forward to the "msg sent" screen.
    than there is method that makes a call to an ejb method to send the msg via email like....
    user_message msg = dispatcher.getMessage();
    persister.store(Message);
    request.getRequestDispatcher("/msgSent.jsp").forward(request,response);
    Mailer.sendNotification(msg.destination.email);
    the problem is : even though i called to the request dispatcher it doesnt forward the message till
    the mail server sends a - 250 OK
    is there a way to solve it without storing data ..?

    You've stored the message in the DB? Does that include all the sender & receiver info?
    If it does you could probably have a thread (started on application startup) whose job it is to pick up messages added to the queue and to send them.
    It is something that worked really well at my last job. The page submits with the request to send the message. Because the message required a lot of processing we stuck the message data on a queue with a NOTPROCESSED status. The thread woke up every ten seconds and grabbed the top ten NOTPROCESSED message (changing status to PROCESSING) and processed them. In the meantime, the page had returned to the user and the sending entity had a status of "sending".
    We found that acceptable where a synchronous processing would take a while and page responsiveness is important.
    Another option is to submit the page but also rewrite the current page with javascript or somesuch. You can display a message "sending, page will reload when sent" or somesuch. I've seen it done elsewhere. I think there is another way to do it but don't know enough to comment on that.
    Mark

  • Servlet for sending email error

    i working for send email using servlet and html. when i run i got this error..
    what cause this problem.
    please someone help me. urgent!!!
    thank you in advance
    servlet error........
    ENCOUNTERED EXCEPTION: java.lang.ArrayIndexOutOfBoundsException
    java.lang.ArrayIndexOutOfBoundsException
         at EmailSMSServlet.doPost(EmailSMSServlet.java:123)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:536)

    here is my code...actually my program send email from SMS. i parser SMS to email format. My SMS part is working but when i combine it,i got error as above. I tried run without servlet (using command prompt) it working properly and i can send email.
    public class EmailSMSServlet extends HttpServlet
    CService srv;
    int status;
    LinkedList msgList;
         public void init(ServletConfig config) throws ServletException      {
         super.init(config);
         srv = new CService("com4", 9600);
         msgList = new LinkedList();
         srv.initialize();
         srv.setCacheDir(".\\");
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException
         PrintWriter writer = response.getWriter();
    response.setContentType("text/html");
    writer.println("<html>");
    writer.println("<head>");
    writer.println("<title>SMS TO EMAIL</title>");
    writer.println("</head>");
    writer.println("<body bgcolor=\"blue\">");
         writer.println("test");
              try
              status = srv.connect();
                   if (status == CService.ERR_OK)
                   srv.setOperationMode(CService.MODE_PDU);
    if(srv.readMessages(msgList,CIncomingMessage.CLASS_ALL)==CService.ERR_OK)
              for (int i = 0; i < msgList.size(); i ++)
              CIncomingMessage msg =(CIncomingMessage)msgList.get(i);
              String s=msg.getText();
              String from1=msg.getOriginator()+"@mysite.bla.bla";
              writer.println(s);
              writer.println("<p>");
              writer.println(from1);
              writer.println("<p>");
    // parser sms to email ...
    String delim = "#";
    StringTokenizer st= new StringTokenizer(s,delim);
    String str[] = new String[st.countTokens()];     
    int j=0;
    while (st.hasMoreTokens())
         str[j++] = st.nextToken();
         writer.println("<p>");
         writer.println("Kepada:");
         writer.println(str[0]);
         for(int k = 0; k < str.length; k++)
    writer.println(str[k]);
    // Send mail using javamail.....
    Properties props=new Properties();
    props.put("mail.transport.default",blah");
    props.put("mail.smtp.host","blah");
    try{
    Properties props=new Properties();
    props.put("mail.transport.default","smtp");
    props.put("mail.smtp.host","host");
    Session mailSession=Session.getInstance(props,null);
    Message mssg=new MimeMessage(mailSession);
    mssg.setSubject(str[1]);
    mssg.setContent(str[2],"text/plain");
    Address to =new InternetAddress(str[0]);
    mssg.setRecipient(Message.RecipientType.TO,to);
    Address from=new InternetAddress(from1);
    mssg.setFrom(from);
    Transport.send(mssg);
         writer.println("Succes");
    } catch (Throwable t) {
    writer.println("<font color=\"red\">");
    writer.println("ENCOUNTERED EXCEPTION: " + t);
    writer.println("<pre>");
    t.printStackTrace(writer);
    writer.println("</pre>");
    writer.println("</font>");
         srv.disconnect();
         else
         writer.println("Connection to mobile failed, error: " + status);
         catch (Exception e)
              e.printStackTrace();
         writer.println("<br><br>");
    writer.println("</body>");
    writer.println("</html>");
    thanks

  • Email with attachment from servlet

    Hi. We're using Java 1.4.2_12 and need to send emails with an image file attachment from a servlet. The JavaMail API looks interesting but wasn't sure if it works with our (ancient) version of Java. Your help is much appreciated. Thanks.
    Edited by: curios_Lee on Jan 16, 2009 8:38 AM

    I didn't find it. Generally people who write Java APIs like that will document restrictions (like "Requires Java 5 or later") if they exist. You won't generally find "Works will all versions of Java" in the documentation because that's just a basic assumption of Java.

  • Send Email Through servlet Code

    Hello Guys,
    When i run a sample email code of tomcat. Its send an error, not found javax.mail.___ i forgot the name. I use windows 2000 how can i run this code
    Thanks Rashid

    There are sample codes on javamail\demo\servlet folder. Maybe you can send mail by the methods in Servlet.

  • Sending emails+attachment from a servlet

    Hi all,
    I'd like to send emails from within my servlet. There must be a possibility to attach a file that has been uploaded to the server in a previous request.
    Currently I'm using sun.net.smtp.SmtpClient to send simple emails.
    Does the sun-smtp-package provide a way to attach a file to an email?
    regards
    Steffen

    I'm not sure but I think the sun.net.smtp package is part of J2EE. I didn't need to download it. You will need a Base64-Encoding algorithm for transforming the file-data (the attachment) into the email message. OReillys servlet package provides a class for this (www.servlets.com).
    Below is an example how to send an email with a file attached to it. You will have to specify the name of an SMTP-Server. If you do not have one you can (for testing purposes) direct the email into a text file.
    try{
         String host = /** @todo place your smtp-server name or IP here */
         SmtpClient smtp = new SmtpClient(host);
         smtp.from(from);
         smtp.to(toList);
         PrintStream out = smtp.startMessage();
         Base64Encoder b64e = new Base64Encoder(out); // Base64Encoder is also a Stream which we will only use for the attachment-data
         /* uncomment this if there is no smtp-server. The email will be stored in a file
         File fEml = new File(/** @todo add your filePath here */+File.separatorChar+"out.eml");
         PrintStream out = new PrintStream(new FileOutputStream(fEml));*/
         out.println("From: "+from);
         out.println("To: "+toList);
         out.println("Subject: "+subject);
         out.println("Date: "+date.toString());
         out.println("MIME-Version: 1.0");
         // we have to declare the email multipart/mixed to notify the email client that this mail contains sub parts of different content-types
         out.println("Content-Type: multipart/mixed;");
         // the boundary-string separates the sub parts (just like in HTTP-Multipart-Requests)
         out.println("\tboundary=\"----=_next_part\"");
         out.println("\r");
         out.println("This is a multipart message in MIME format.");
         out.println("\r");
         // first sub part starts here - its the text message
         out.println("------=_next_part");
         // this sub part contains only plain text
         out.println("Content-Type: text/plain;");
         out.println("\tcharset=\"iso-8859-1\"");
         out.println("Content-Transfer-Encoding: 7bit");
         out.println("\r");
         // Message text goes here
         out.println(/** @todo place your message here */);
         out.println("\r");
         // now the attachment
    out.println("------=_next_part");
    out.println("Content-Type: application/octet-stream;");
    out.println("\tname=\""+fileName+"\"");
    out.println("Content-Transfer-Encoding: base64");
    out.println("Content-Disposition: attachment;");
    out.println("\tfilename=\""+fileName+"\"");
    out.println("\n");
    // encode file piece by piece
    File f = new File(/** @todo place your filepath here */+File.separatorChar+fileName);
    FileInputStream fis = new FileInputStream(f);
    int i = 0;
    do{
    byte[] content = {0, 0, 0};
    i = fis.read(content, 0, 3);
    if (i != -1){
                   b64e.write(content);
         }//if
    }while(i != -1);
    fis.close();
    fis = null;
    f = null;
         // this is it, all there's left to do is to flush our output-stream and clean up
         out.flush();
         b64e.close();
         out.close();
         b64e = null;
         smtp.closeServer();
         out = null;
         smtp = null;
    }catch(IOException ioe){
         ioe.printStackTrace();
    }//catch
    HTH
    Steffen

  • Problems when sending an email through a servlet

    Hi I have a servlet trying to send an email to an address given.. but the servlet does not respond at all, it doesn's throw any exception nor displays any message, anything I hope you can help, this is the DoGet method I have in the servlet:
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    System.out.println("In doGet method");
    StringBuffer body=null;
    try {           
    body = setBodyMessage(request);
    sendmail(body);
    out.println("<table align=center cols= 2 border=0 width=100% height=100% >");
    out.println("<tr><td>");
    out.println("<div align=center><b><font face=Arial, Helvetica, align=center sans-serif size=4 color='red'> The Change request was sent </font></b></div></td></tr></table>");
    catch(NullPointerException e){
    e.printStackTrace();
    out.println(e.toString());
    out.println(e.getMessage());
    catch (Exception e) {
    e.printStackTrace();
    System.err.println(e.toString());
    System.out.println(e.toString());
    finally{
    out.close();
    The function setBodyMessage, sets a properly e-mail body message to be sent by the parameters that come from a previous form page.
    I have this sendmail method defined as follow:
    public void sendmail(StringBuffer mailBody){
    String email = "[email protected]";
    try{
    PrintStream outmail;
    SmtpClient send = new SmtpClient("nyschx06psge.sch.ge.com");
    send.from("[email protected]");
    send.to(email);
    outmail = send.startMessage();
    outmail.println("From: [email protected]");
    outmail.println("To: " + email);
    outmail.println("Subject: Welcome");
    outmail.println(mailBody.toString());
    outmail.flush();
    outmail.close();
    send.closeServer();
    catch (Exception e) {
    System.out.println(e.toString());
    e.printStackTrace();
    I try it out in a jsp page and the code works but I need it running in a servlet. Can anyone help me please?, thanks in advance.
    Regards.

    Are you able to print the value of StringBuffer body before calling the sendmail method?

  • Problem sending email using javamail in servlet

    I try this code and make some changes of my own http://forums.sun.com/thread.jspa?threadID=695781.
    When i run the program the confirmtaion shows that the mail has been sent, but when i check in my inbox there's no the message. I'm using gmail and need to authenticate the username and password. I guess the error caused in the servlet.
    Here's the code for my servlet :
    import java.io.*;
    import java.util.Properties;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.mail.internet.*;
    import javax.mail.*;
    public class ServletEx extends HttpServlet {
       public void doPost(HttpServletRequest request, HttpServletResponse response)
             throws IOException, ServletException {
          System.out.println("____emailservlet.doPost");
          response.setContentType("text/plain");
          PrintWriter out = response.getWriter();
          System.out.println("______________________________");
          out.println();
          String to = request.getParameter("to");
          System.out.println("____________________________to" + to);
          String subject = request.getParameter("subject");
          String msg = request.getParameter("msg");
          // construct an instance of EmailSender
          System.out.println("servlet_to" + to);
          send(username, to, subject, msg);
          //send("[email protected]", to, subject, msg);
          out.println("mail sent....");
            String username = "[email protected]";
            String password = "my_password";
            String smtp = "smtp.gmail.com";
            String port = "587";
       public void send(String username, String to, String subject, String msg) {
            Properties props = new Properties();
            props.put("mail.smtp.user", username);
            props.put("mail.smtp.host", smtp);
            props.put("mail.smtp.port", port);
            props.put("mail.smtp.starttls.enable","true"); // just in case, but not currently necessary, oddly enough
            props.put("mail.smtp.auth", "true");
            //props.put("mail.smtp.debug", "true");
            props.put("mail.smtp.socketFactory.port", port);
            props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
            props.put("mail.smtp.socketFactory.fallback", "false");
            SecurityManager security = System.getSecurityManager();
            try
                Authenticator auth = new SMTPAuthenticator();
                Session session = Session.getInstance(props, auth);
                //session.setDebug(true);
                MimeMessage message = new MimeMessage(session);
                message.setText(msg);
                message.setSubject(subject);
                message.setFrom(new InternetAddress(username));
                message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
                Transport.send(message);
            catch (Exception mex)
                mex.printStackTrace();
       public class SMTPAuthenticator extends javax.mail.Authenticator {
            public PasswordAuthentication getPasswordAuthentication(String username, String password)
                return new PasswordAuthentication(username, password);
    }Actually it's been a long time for me to develope this program, especially with the authenticate smtp. Any help would be very appreciated :)

    Accordingly to your stackTrace, I think that you miss some utility jar from Geronimo app. server.
    As you are using Application server that is J2EE compliant, so there is an own JavaMail implementation embeded and used by the Server. To fix this problem you have to find and add to your calsspath a jar-file that contains Base64EncoderStream.class

  • How to send a email from a servlet

    Hi,
    I'm trying to send a e-mail from a servlet, but I don't know how to do it!!
    Please , help me
    Thanks

    Have a look at the Java Mail API and at the JAVA Mail Forum.

  • J2EE Logon Servlet Prompting For Username Email

    I have a situation in my landscape that recently, after patching the system to NW700 SPS23, some users would enter their logon and password correctly and then get confronted with an additional security screen requesting their firstname, lastname, email address and a message for the administrator (as if they were trying to perform self registration).  They would kindly enter the requested information and it would pop up again and again, preventing use of the system.  This doesn't happen to everyone though and appears to be in some way related to the URL the user was using.
    I set logging to debug and could not find any trace of an error in the java logs when this occured.  Ultimately, I provded a cleaner URL string (http://<server>:<port>/useradmin for example), had the user clear their browser cache, restart IE, and then it went away for them, even when using the old dirty URL.   I am 100% positive it was not password related as I could log in fine on my machine, but not on another with my own and other admin accounts.
    My question is: is anyone aware of any new security features implemented in NW700 SPS22 or 23 that could be causing this problem on some front-ends?  Our users use Windows 7 and IE 8.    It also occured on a calling java application server running IBM Websphere and an older OS and browser.  This is what has me so suspicious about the patches themeselves.
    The SAP app that is running on the NW700 machine is XMII 12.0.21.  Though the symptom also occurs with calls to NWA, UME, SLD, etc.  I also run a 701 webdispatcher on the machine which does some url translations, but again, it works fine on most front-ends.
    Regards,
    Phillip

    https://service.sap.com/sap/support/notes/957666
    Use this above tool, install it and it is a flash based application which runs on J2EE.
    I have resolved all my portal security issues using this tool.
    Also do you have any SPnego authentication or conventional?
    Regards
    SM.

  • Building a simple email application using servlet

    i'm having problem with my codes. actually,i'm using james(java apache mail enterprise server) as my transport agent. my problem is linking james with my java compiler(Netbean 4.1).my main class is a servlet class.my application is suppose to receive,delete,forward,compose mail messages. if u have a good experience in this,please could u send a sample code to me so as to know where i'm actually wrong. I need this to see a different view 2 my implementation.
    thanks

    Hi there
    I'm having the same problem. I'm using Netbeans 5.0 with the mobility pack. My version of JDK is 1.5.0_02.
    I include the jxme-cdc.jar file to the project but when I try to run the application I get:
    Error preverifying class net.jxta.id.ID
    java/lang/NoClassDefFoundError: java/io/Serializable
    Have you figured out how to resolve this???

Maybe you are looking for

  • PO Upload Error "Account does not exist in chart of accounts"

    Hi All, I am trying to upload PO data using LSMW (IDOC "PORDCR101"). For records which have GL account they(IDOC's) are erroring out with message "Account XXXXX does not exist in chart of accounts GBCA". But the funny part is if I am able to create a

  • No images in Mac Mail

    I used to be able to see images in Mac Mail. I think it stopped after upgrading to Lion. Now the e-mail looks like this: Instead of this: And yes, I have checked the "display images in remote HTML: Any advice? This has been going on for months! Thank

  • How do i copy a iphoto album to a disc?

    Hi Y'all,  I tried highlighting the ' album'  then burning. What I get is the order of the pictures that is in the 'events' .  I want the photos organized the way they are arranged in the 'album'.  iPhoto '11,  Lion OS,  iMac.  All up to date.  Thank

  • PDF help. printing PDFs make acrobat or reader go not responding.

    Whenever i try to print or go to print setup in either Acrobat or Reader it cause the program to not respond and i will have to exit the program and it will not print. But if i right-click a .pdf file (like saved on my desktop) and click print it wil

  • Dynamic excel connection string

    Hi,  I have excel file as source, where the file name can be anything; so to fetch the data from the excel file, I wanted to create a dynamic excel connection string.  So these are the following steps I have followed: 1. For Each Loop:  Step 2: Step