Not able to sending the Mail using java mail utility

Hi, I am new to java mail utility and written first time for sending mail. If any body an help me out in resolving the problem I would be thankful to him/her........below is the code which I m trying......
package test;
import javax.servlet.http.HttpServlet;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
/*import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;*/
* @author chauhasd
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
public class SendMailServlet extends HttpServlet{
     public SendMailServlet(){
     public void sendMail(){
          java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
          Properties props=new Properties();
          props.put("mail.transport.protocol", "smtp");
          props.put("mail.smtp.host","pcsttc.patni.com");
          props.put("mail.smtp.port","25");
          props.put("mail.smtp.auth","true");
          props.put("mail.smtp.starttls.enable","true");
          Session session=Session.getDefaultInstance(props,new MyAuthenticator());
          session.setDebug(true);
          MimeMessage message=new MimeMessage(session);
          try{
               message.setContent("Hello....","text/plain");
               message.setSubject("Testing Mail");
               Address strTo = new InternetAddress("[email protected]");
               Address strFrom = new InternetAddress("[email protected]");
               Address strReplyTO = new InternetAddress("[email protected]");
               message.setFrom(strFrom);
               message.setReplyTo(new Address[]{strReplyTO});
               message.setRecipient(Message.RecipientType.TO,strTo);
               Transport.send(message);
          }catch (AddressException e)
//               TODO Auto-generated catch block
               e.printStackTrace();
          }catch (NoSuchProviderException e){
//               TODO Auto-generated catch block
               e.printStackTrace();
          }catch (MessagingException e){
//               TODO Auto-generated catch block
               e.printStackTrace();
     protected PasswordAuthentication getPasswordAuthentication()
          return new PasswordAuthentication("[email protected]", "sid35789");
     public static void main(String [] args){
          new SendMailServlet().sendMail();
ERROR :
DEBUG: setDebug: JavaMail version 1.3.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
javax.mail.SendFailedException: Sending failed;
nested exception is:
     class javax.mail.AuthenticationFailedException
     at javax.mail.Transport.send0(Transport.java:218)
     at javax.mail.Transport.send(Transport.java:80)
     at test.SendMailServlet.sendMail(SendMailServlet.java:59)
     at test.SendMailServlet.main(SendMailServlet.java:81)

Sangyesh wrote:
In my application,we already implemented it so we cant go for javamail.That does not make sense. Your 'implementation' does not work so you have not yet fully 'implemented' it. Using Javamail takes about 4 lines of code to do what you have done so far and it will work.
Please suggest me regarding this,so that I can go ahead and resolve it.Use the Javamail API.

Similar Messages

  • How to send Secured Mail using Java Mail?

    I want to send mails with "Send Secure" option using Java Mail. Now mails are being sent using Java Mail connecting to smtp host.
    Appreciating your help.
    Thanks.

    There are third party libraries to help with this. Bouncy Castle is very popular.
    See the [JavaMail Third Party Products|http://java.sun.com/products/javamail/Third_Party.html] page.

  • How to send HTML Format Mail using Java Mail in oracle 9i Forms

    Dear All
    could you please tell me how to send HTML Format Mail using Java Mail in oracle 9i Forms and how to implement the java mail ?
    if it is possible, could you please send me the sample code? please very urgent
    Thanks
    P.Sivaraman

    Hello,
    <p>Here is a Form sample.</p>
    Francois

  • Not able to change the password using FNDCPASS

    I am not able to change password using FNDCPASS. I am getting follwoing error while executing following command with APPLMGR user ( before that I have source the .env file ) (OS-Linux)
    [applmgr@ora11 /]$ FNDCPASS apps/apps 0 Y system/manager SYSTEM APPLSYS WELCOME
    Log filename : L2741743.log
    Report filename : O2741743.out
    APP-FND-01630: Cannot open file L2741743.log for appending
    Cause: FDPFOP encountered an error when attempting to open file L2741743.log for appending.
    Action: Verify that the filename is correct and that the environment variables controlling that filename are correct.
    Action: If the file is opened in read mode, check that the file exists. Check that you have privileges to read the file in the file directory. Contact your system administrator to obtain read privileges.
    Action: If the file is opened in write or append mode, check that you have privileges to create and write files in the file directory. Contact your system administrator to obtain create and write privileges.
    Can some one pls guide me on this

    Duplicate post-
    Not able to change the password using FNDCPASS
    Please post only once.
    Thanks,

  • Certen user is not able to create the sc using sepecific vendor

    Hi,
    User is not able to create the SC entering specific  vendor .
    This vendor is in maintained in SRM for one pur.org (I have checked in PPOMA_BBP).
    Then why he is not able to creating the sc using this Vendor

    whether user is belong to same region of the Vendor or different. Is there any enhancements you have like that.
    Please check those things.
    Hope this will help.
    Thanks
    Venkatesh P

  • I am trying to authenticate at Filevault preboot using external Serial (RS232) to USB convertor where USB port is connected to my mac machine.But on preboot I am not able to type the password using console where my machine is connected.

    I am using an external keyboard which is actually a Device KeyAT who do the keyboard simulator kind of operation over Serial (RS232) to USB connector.
    I have a controller machine connected with Serial Port and MAC machine is connected by a USB port to that device.
    I am able to type the password on OS X login screen but on using the same device and set up on Filevault preboot I am not able to type the password.
    This connector is detected as a USB 2.0 composite device in System Hardware table.
    Can someone hints or point out a potential cause or to rectify this issue.
    Thanks in Advance.

    Which os version are you using? 
    Which iPod Nano model do you have?  iPod Models 
    iPod not recognized in iTunes and Mac desktop 

  • Not able to update the project using 'BAPI_PROJECT_MAINTAIN'.

    I  want to create a project , with reference to an already existing project.
    I am using 'BAPI_PROJECT_GETINFO' to get the data of the existing project.
      The bapi gives the following:
    1)     e_project_definition.
    2)     e_wbs_element_table.
    3)     e_wbs_hierarchie_table
    I am passing the u2018e_project_definitionu2019 to 'BAPI_PROJECTDEF_CREATE' to create project.The project is created successfully.
    But I am not able to update the project with u2018e_wbs_element_tableu2019
    and u2018e_wbs_hierarchie_tableu2019. I am using 'BAPI_PROJECT_MAINTAIN' to update the project.
    The program is not giving an error, but it is also not updating the E_WBS_ELEMENT_TABLE and E_WBS_HIERARCHIE_TABLE.
    I am attaching the code below.
    *& Report  ZTEST_PC.
    DATA: project_definition   TYPE  bapipr-project_definition,
          with_activities      TYPE  bapipr-with_activities,
          with_milestones      TYPE  bapipr-with_milestones,
          with_subtree         TYPE  bapipr-with_subtree,
          e_project_definition TYPE  bapi_project_definition_ex,
          return               TYPE  bapireturn1.
    DATA: i_wbs_element_table         TYPE TABLE OF     bapi_wbs_elements,
          e_wbs_element_table         TYPE TABLE OF     bapi_wbs_element_exp,
          e_wbs_milestone_table   TYPE TABLE OF bapi_wbs_milestone_exp,
          e_wbs_hierarchie_table  TYPE TABLE OF bapi_wbs_hierarchie,
          e_activity_table        TYPE TABLE OF bapi_network_activity_exp,
          e_message_table         TYPE TABLE OF bapi_meth_message.
    DATA: wa_wbs_element_table    TYPE      bapi_wbs_element_exp,
          wa_wbs_hierarchie_table TYPE  bapi_wbs_hierarchie.
    DATA: l_new_proj_no TYPE  prpss-posid.
    DATA: l_project_definition        TYPE  bapi_project_definition.
    DATA: l_project_definition_upd    TYPE  bapi_project_definition_up.
    DATA: l_project_definition_stru   TYPE  bapi_project_definition.
    DATA :l_pspnr      TYPE ps_intnr,
          l_pspid      TYPE ps_pspid,
          l_pro_def(9) TYPE c.
    DATA :l_proj  TYPE proj.
    DATA :l_len TYPE i VALUE '0'.
    DATA: lt_dd03l TYPE TABLE OF dd03l,
          ls_dd03l TYPE dd03l.
    DATA: fieldname(50), fieldname1(50) TYPE c.
    DATA: p_ddic_name(40), struc(40), fun_struc(50) TYPE c.
    FIELD-SYMBOLS: <struc>, <c>, <sc>, <def_field> TYPE any.
    DATA : i_method_project    TYPE TABLE OF bapi_method_project,
           wa_method_project   TYPE  bapi_method_project.
    DATA : l_index TYPE bapi_method_project-refnumber.
    DATA : it_wbs_element_table         TYPE TABLE OF bapi_wbs_element,
           it_wbs_hierarchie_table      TYPE TABLE OF bapi_wbs_hierarchie.
    DATA : wl_wbs_element_table         TYPE bapi_wbs_element,
           wl_wbs_hierarchie_table      TYPE bapi_wbs_hierarchie.
    DATA : l_wbs_element_table_update   TYPE bapi_wbs_element_update.
    DATA : i_wbs_element_table_update   TYPE TABLE OF bapi_wbs_element_update.
    Get the project info of the Project 'C01.10995'
    CALL FUNCTION 'CONVERSION_EXIT_ABPSN_INPUT'
      EXPORTING
        input  = 'C01.10995'
      IMPORTING
        output = project_definition.
    CALL FUNCTION 'BAPI_PROJECT_GETINFO'
      EXPORTING
        project_definition     = project_definition
      IMPORTING
        e_project_definition   = e_project_definition
        return                 = return
      TABLES
        i_wbs_element_table    = i_wbs_element_table
        e_wbs_element_table    = e_wbs_element_table
        e_wbs_milestone_table  = e_wbs_milestone_table
        e_wbs_hierarchie_table = e_wbs_hierarchie_table
        e_activity_table       = e_activity_table
        e_message_table        = e_message_table.
    Automate the process the process to get the next number for the func module 'CN_SUCHE_FREIE_NUMMER'.
    CLEAR : l_pspnr, l_pspnr, l_pspid, l_pro_def.
    SELECT MAX( pspnr ) FROM proj INTO l_pspnr.
    SELECT SINGLE * FROM proj INTO l_proj WHERE pspnr EQ l_pspnr.
    l_pspid = l_proj-pspid.
    CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
      EXPORTING
        input  = l_pspid
      IMPORTING
        output = l_pspid.
    l_pro_def = l_pspid+4(5) + 1.
    CONDENSE l_pro_def.
    CONCATENATE 'C01.' l_pro_def INTO l_pspid .
    function module to generate the nect free number between the given range.
    CALL FUNCTION 'CN_SUCHE_FREIE_NUMMER'
      EXPORTING
        search_imp = '2'
        prps_s_imp = l_pspid
        prps_e_imp = 'C01.29999'
        no_dialog  = 'X'
      IMPORTING
        prps_exp   = l_new_proj_no.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.
    Update the fields of 'l_project_definition_upd' as 'X' for the fields which has values in 'E_PROJECT_DEFINITION'.
    Get the New Project Number.
    MOVE-CORRESPONDING e_project_definition TO l_project_definition.
    l_project_definition-project_definition = l_project_definition-project_definition+0(3).
    l_new_proj_no = l_new_proj_no+4(5).
    CONCATENATE l_project_definition-project_definition '.' l_new_proj_no INTO l_project_definition-project_definition.
    TRANSLATE l_project_definition-project_definition TO UPPER CASE.
    MOVE-CORRESPONDING l_project_definition TO l_project_definition_stru.
    Create the New project with the New project Number.
    CALL FUNCTION 'BAPI_PROJECTDEF_CREATE'
      EXPORTING
        project_definition_stru = l_project_definition_stru.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = ' '.
    Populate internal table i_method_project for the bapi_project_maintain func module.
    CLEAR : wa_wbs_element_table,wl_wbs_element_table,wa_wbs_hierarchie_table,
            wl_wbs_hierarchie_table, it_wbs_element_table, it_wbs_hierarchie_table.
    CLEAR : wa_method_project, i_method_project, l_index .
    l_index = 0.
    LOOP AT e_wbs_element_table INTO wa_wbs_element_table.
      MOVE-CORRESPONDING wa_wbs_element_table TO wl_wbs_element_table .
      APPEND  wl_wbs_element_table  TO it_wbs_element_table .
      wa_method_project-objecttype = 'WBS_ELEMENT'.
      wa_method_project-method     = 'CREATE'.
      wa_method_project-objectkey  = wa_wbs_element_table-wbs_element.
      l_len = strlen( wa_wbs_element_table-wbs_element ).
    Setting Levels as reference number.
      CASE l_len.
        WHEN '9'.
          l_index = 1.
        WHEN '12'.
          l_index = 2.
        WHEN '15'.
          l_index = 3.
        WHEN '18'.
          l_index = 4.
      ENDCASE.
      wa_method_project-refnumber  =  l_index .
      TRANSLATE wa_method_project-objectkey TO UPPER CASE.
      APPEND wa_method_project TO i_method_project.
      CLEAR :wa_method_project, l_index.
    ENDLOOP.
    l_index = l_index + 1.
    wa_method_project-refnumber  = ' '.  "l_index .
    wa_method_project-objecttype = ' '.  "'WBS_ELEMENT'.
    wa_method_project-method     = 'SAVE'.
    wa_method_project-objectkey  = ' '.
    APPEND wa_method_project TO i_method_project.
    CLEAR wa_method_project.
    LOOP AT e_wbs_hierarchie_table INTO wa_wbs_hierarchie_table.
      MOVE-CORRESPONDING wa_wbs_hierarchie_table TO wl_wbs_hierarchie_table.
      APPEND wl_wbs_hierarchie_table TO it_wbs_hierarchie_table.
    ENDLOOP.
    Update the fields of 'l_project_definition_upd' as 'X' for the fields which has values in 'E_PROJECT_DEFINITION' respectively.
    CLEAR : l_project_definition_upd.
    p_ddic_name = 'BAPI_PROJECT_DEFINITION_UP'.
    struc       = 'l_project_definition_upd'.
    fun_struc   = 'E_PROJECT_DEFINITION'.
    TRANSLATE: p_ddic_name TO UPPER CASE,
               struc       TO UPPER CASE.
    SELECT * FROM dd03l INTO TABLE lt_dd03l WHERE tabname = p_ddic_name.
    LOOP AT lt_dd03l INTO ls_dd03l.
      ASSIGN ls_dd03l-fieldname TO <c>.
      fieldname = ls_dd03l-fieldname .
      CONCATENATE fun_struc '-' fieldname INTO fieldname.
      ASSIGN (struc) TO <struc>.
      ASSIGN COMPONENT <c> OF STRUCTURE <struc> TO <sc>.
      ASSIGN (fieldname) TO <def_field>.
      IF NOT <def_field> IS INITIAL  .
        <sc> = 'X'.
      ENDIF.
    ENDLOOP.
    Update the fields of 'l_wbs_element_table_update' as 'X' for the fields which has values in 'e_wbs_element_table' respectively.
    READ TABLE e_wbs_element_table INTO wa_wbs_element_table INDEX '1'.
    CLEAR : l_wbs_element_table_update, fieldname1, p_ddic_name, struc, fun_struc .
    p_ddic_name = 'BAPI_WBS_ELEMENT_UPDATE'.
    struc       = 'l_wbs_element_table_update'.
    fun_struc   = 'WA_WBS_ELEMENT_TABLE'.
    TRANSLATE: p_ddic_name TO UPPER CASE,
               struc       TO UPPER CASE.
    SELECT * FROM dd03l INTO TABLE lt_dd03l WHERE tabname = p_ddic_name.
    LOOP AT lt_dd03l INTO ls_dd03l.
      ASSIGN ls_dd03l-fieldname TO <c>.
      fieldname = ls_dd03l-fieldname .
      CONCATENATE fun_struc '-' fieldname INTO fieldname.
      ASSIGN (struc) TO <struc>.
      ASSIGN COMPONENT <c> OF STRUCTURE <struc> TO <sc>.
      ASSIGN (fieldname) TO <def_field>.
      IF NOT <def_field> IS INITIAL  .
        <sc> = 'X'.
      ENDIF.
    ENDLOOP.
    Append the value of l_wbs_element_table_update TO the table i_wbs_element_table_update for Bapi_project_maintain.
    CLEAR i_wbs_element_table_update.
    APPEND l_wbs_element_table_update TO i_wbs_element_table_update.
    CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
      EXPORTING
        i_project_definition       = l_project_definition
        i_project_definition_upd   = l_project_definition_upd
      TABLES
        i_method_project           = i_method_project
        i_wbs_element_table_update = i_wbs_element_table_update
        i_wbs_element_table        = it_wbs_element_table.
       i_wbs_hierarchie_table     = it_wbs_hierarchie_table.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = ' '.
    Please help me to solve the issue.

    I am not sure why it is not working??  Try for any other alternate function modules.
    But i see one issue with your coding, always check the return table message type and use commit work, instead of sy-subrc check. This fails for BAPI's

  • What are the prerequisits i need to send a mail using java mail

    i have a class file using javamail.
    I want to validate the email id's and send to particular address.
    will u please tell me the process and prerequisits to send the mail(like SMTP server,username ,password..)
    Please what actually username , password is ment in an authenticated javamail program.
    is it user account on SMTP server / email id
    Thanks.
    Prasantha Reddy C

    Hi,
    you need your smtp host address and smtp user name and password to send emails out.
    and yes the user name and password are the smtp username and password for authentication
    regards
    shyam

  • User not able to send the mail from other mail box on outlook 2007

    In my outlook(2007), i am using my mail box to send the mail and receiving the mail every thing working fine, now what happened , i am adding one of my users mail box to my outlook profile,and trying to send the mail from that mail box,when ever
    i am trying to send its give me the message called message undelivered  and permission error. as i am full permission on that users mail box. but still getting that issue.
    My lab info
    Exchange server 2010 sp3
    outlook 2007

    HI Paul,
    In exchange, you have something called Send as permission as well. Try to give send as permission to your self from the user's mailbox.
    In exchange> Reciepient config> Mailboxes> user mailbox> right click> Full Send as permssion
    or,
    Add-ADPermission -Identity "user1" -User "[email protected]" -ExtendedRights Send-As
    After you add your self in send as permission you need to wait for some time to propagate the settings or you can forcefully reset the information store services
    That should solve your issue.
    UMESH DEUJA MCP,MCTS,MCSA,CCNA

  • How can I forward a web page (not a link but the page) using Mac Mail'Mountain Lion?

    I want to mail a web page, not a link to the page but the page itself. I use Mountain Lion and Mac Mail. I used to be able to do this with Lion.

    Look in the outgoing email message window. Make sure Send Web Content is not set to Link Only

  • Not able to Send HTML Content in Apex Mail

    Hi,
    I am using Oracle Apex 4.2 and Oracle 11g XE
    I am trying to add HTML content in the apex_send mail procedure. But it give me the below error.
    >>•ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
    Below is the code i am trying to add in the apex_send mail
    DECLARE
    l_from varchar2(1000);
    l_body CLOB;
    l_body_html CLOB;
    BEGIN
    l_body := null;
    l_body_html := '
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta property="og:title" content="Seasons Greetings from sudhir Networks" />
    <title>Seasons Greetings from sudhir Networks</title>
    <style type="text/css">
    /* Client-specific Styles */
    #outlook a{padding:0;} /* Force Outlook to provide a "view in browser" button. */
    body{width:100% !important;} .ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail to display emails at full width */
    body{-webkit-text-size-adjust:none;} /* Prevent Webkit platforms from changing default text sizes. */
    /* Reset Styles */
    body{margin:0; padding:0;}
    img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;}
    table td{border-collapse:collapse;}
    #backgroundTable{height:100% !important; margin:0; padding:0; width:100% !important;}
    body, #backgroundTable{
    /*@editable*/ background-color:#FAFAFA;
    #templateContainer{
    /*@editable*/ border: 1px solid #DDDDDD;
    h1, .h1{
    /*@editable*/ color:#202020;
    display:block;
    /*@editable*/ font-family:Arial;
    /*@editable*/ font-size:34px;
    /*@editable*/ font-weight:bold;
    /*@editable*/ line-height:100%;
    margin-top:0;
    margin-right:0;
    margin-bottom:10px;
    margin-left:0;
    /*@editable*/ text-align:left;
    h2, .h2{
    /*@editable*/ color:#202020;
    display:block;
    /*@editable*/ font-family:Arial;
    /*@editable*/ font-size:30px;
    /*@editable*/ font-weight:bold;
    /*@editable*/ line-height:100%;
    margin-top:0;
    margin-right:0;
    margin-bottom:10px;
    margin-left:0;
    /*@editable*/ text-align:left;
    h3, .h3{
    /*@editable*/ color:#202020;
    display:block;
    /*@editable*/ font-family:Arial;
    /*@editable*/ font-size:26px;
    /*@editable*/ font-weight:bold;
    /*@editable*/ line-height:100%;
    margin-top:0;
    margin-right:0;
    margin-bottom:10px;
    margin-left:0;
    /*@editable*/ text-align:left;
    h4, .h4{
    /*@editable*/ color:#202020;
    display:block;
    /*@editable*/ font-family:Arial;
    /*@editable*/ font-size:22px;
    /*@editable*/ font-weight:bold;
    /*@editable*/ line-height:100%;
    margin-top:0;
    margin-right:0;
    margin-bottom:10px;
    margin-left:0;
    /*@editable*/ text-align:left;
    #templatePreheader{
    /*@editable*/ background-color:#FAFAFA;
    .preheaderContent div{
    /*@editable*/ color:#505050;
    /*@editable*/ font-family:Arial;
    /*@editable*/ font-size:10px;
    /*@editable*/ line-height:100%;
    /*@editable*/ text-align:left;
    .preheaderContent div a:link, .preheaderContent div a:visited, /* Yahoo! Mail Override */ .preheaderContent div a .yshortcuts /* Yahoo! Mail Override */{
    /*@editable*/ color:#336699;
    /*@editable*/ font-weight:normal;
    /*@editable*/ text-decoration:underline;
    #templateHeader{
    /*@editable*/ background-color:#FFFFFF;
    /*@editable*/ border-bottom:0;
    .headerContent{
    /*@editable*/ color:#202020;
    /*@editable*/ font-family:Arial;
    /*@editable*/ font-size:34px;
    /*@editable*/ font-weight:bold;
    /*@editable*/ line-height:100%;
    /*@editable*/ padding:0;
    /*@editable*/ text-align:center;
    /*@editable*/ vertical-align:middle;
    .headerContent a:link, .headerContent a:visited, /* Yahoo! Mail Override */ .headerContent a .yshortcuts /* Yahoo! Mail Override */{
    /*@editable*/ color:#336699;
    /*@editable*/ font-weight:normal;
    /*@editable*/ text-decoration:underline;
    #headerImage{
    height:auto;
    max-width:600px;
    #templateContainer, .bodyContent{
    /*@editable*/ background-color:#FFFFFF;
    .bodyContent div{
    /*@editable*/ color:#505050;
    /*@editable*/ font-family:Arial;
    /*@editable*/ font-size:14px;
    /*@editable*/ line-height:150%;
    /*@editable*/ text-align:left;
    .bodyContent div a:link, .bodyContent div a:visited, /* Yahoo! Mail Override */ .bodyContent div a .yshortcuts /* Yahoo! Mail Override */{
    /*@editable*/ color:#336699;
    /*@editable*/ font-weight:normal;
    /*@editable*/ text-decoration:underline;
    .bodyContent img{
    display:inline;
    height:auto;
    #templateFooter{
    /*@editable*/ background-color:#FFFFFF;
    /*@editable*/ border-top:0;
    .footerContent div{
    /*@editable*/ color:#707070;
    /*@editable*/ font-family:Arial;
    /*@editable*/ font-size:12px;
    /*@editable*/ line-height:125%;
    /*@editable*/ text-align:left;
    .footerContent div a:link, .footerContent div a:visited, /* Yahoo! Mail Override */ .footerContent div a .yshortcuts /* Yahoo! Mail Override */{
    /*@editable*/ color:#336699;
    /*@editable*/ font-weight:normal;
    /*@editable*/ text-decoration:underline;
    .footerContent img{
    display:inline;
    #social{
    /*@editable*/ background-color:#FAFAFA;
    /*@editable*/ border:0;
    #social div{
    /*@editable*/ text-align:center;
    #utility{
    /*@editable*/ background-color:#FFFFFF;
    /*@editable*/ border:0;
    #utility div{
    /*@editable*/ text-align:center;
    #monkeyRewards img{
    max-width:190px;
    </style>
    </head>
    <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
    <center>
    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="backgroundTable">
    <tr>
    <td align="center" valign="top">
    <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateContainer">
    <tr>
    <td align="center" valign="top">
    <!-- // Begin Template Header \\ -->
    <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateHeader">
    <tr>
    <td class="headerContent">
    <img src="http://www.sudhirnetworks.com/i/logo/sudhir-logo.png" style="max-width:600px; padding-top: 20px;" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext />
    </td>
    </tr>
    </table>
    <!-- // End Template Header \\ -->
    </td>
    </tr>
    <tr>
    <td align="center" valign="top">
    <!-- // Begin Template Body \\ -->
    <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateBody">
    <tr>
    <td valign="top" class="bodyContent">
    <!-- // Begin Module: Standard Postcard Content \\ -->
    <table border="0" cellpadding="20" cellspacing="0" width="100%">
    <tr mc:repeatable>
    <td valign="top">
    <img src="http://www1.sudhirnetworks.com/ecard/sudhir_holidaycard_clickhere.jpg" style="width:560px;" mc:label="postcard_image" mc:edit="postcard_image" mc:allowtext />
    <div mc:edit="std_content00">
    <strong>Custom Message</strong> goes here.
    </div>
    </td>
    </tr>
    </table>
    <!-- // End Module: Standard Postcard Content \\ -->
    </td>
    </tr>
    </table>
    <!-- // End Template Body \\ -->
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </center>
    </body>
    </html>
    l_from := lower(:app_user) || lower('@sudhirnetworks.com');
    apex_mail.send(
    p_to => :P1_TO,
    p_from => l_from,
    p_body => l_body,
    p_body_html => L_BODY_HTML,
    p_subj => :P1_SUBJECT);
    APEX_MAIL.PUSH_QUEUE;
    END;
    Please suggest me how to fix this issue.
    Thanks
    Sudhir

    What happens if the user isn't reading the message in a HTML enabled mail client?
    Besides, even if you don't want to send an equivelant message in plain text, at least say something like 'Please open the message in an HTML enabled mail client'.
    It is a required field, so requires some value (not null).
    From the docs:
    Plain text and HTML email content. Passing a value to p_body, but not p_body_html results in a plain text message. Passing a value to p_body and p_body_html yields a multi-part message that includes both plain text and HTML content. The settings and capabilities of the recipient's email client determine what displays. Although most modern email clients can read an HTML formatted email, remember that some users disable this functionality to address security issues.

  • Read  the email using java mail api for Imap account which is secured SSL

    hello,
    I am trying read the new mails on my imap account... i am not able to connect to the imap account... could anyone help me out ..
    below is the code
    public class EmailImapGateway implements MessageCountListener{
    private static final long serialVersionUID = 1L;
         private Session session = null;
         private IMAPStore store = null;
         private IMAPFolder folder = null;
         Properties props = new Properties();
         public void ejbCreate() {
         try {
         if (session == null)
              session = Session.getDefaultInstance(props, null);
              if (store == null || !store.isConnected()) {
    String host, name, passwd;
         host = "host";
              name = "user";
              passwd = "passwd";
              String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
              props.setProperty("mail.imap.socketFactory.class", SSL_FACTORY);
              props.setProperty("mail.imap.socketFactory.fallback", "false");
              props.setProperty("mail.imap.socketFactory.port", "888");
              java.security.Security.setProperty( "ssl.SocketFactory.provider", SSL_FACTORY);
              props.put("mail.imap.host", host);
              props.put("mail.imap.port", "888");
              store = (IMAPStore) session.getStore("imap");
              store.connect();
              folder = (IMAPFolder) store.getFolder("Inbox");
              folder.open(Folder.READ_WRITE);
              int t = folder.getUnreadMessageCount();
              System.out.println("getunreadmessagecount is :" + t);
    }catch (Exception e) {
              e.printStackTrace();
         } finally {
              try {
                   folder.close(true);
                   store.close();
              } catch (MessagingException e) {
                   e.printStackTrace();
         public void ejbActivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbPassivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbRemove() {
              // TODO Auto-generated method stub
         public void messagesAdded(MessageCountEvent arg0) {
              System.out.println("Message is added in inbox");
         public void messagesRemoved(MessageCountEvent arg0) {
              System.out.println("Message is removed from inbox");
    it is not able to connect to my account
    Edited by: bhavna84 on Sep 8, 2008 11:10 PM
    Edited by: bhavna84 on Sep 8, 2008 11:20 PM

    Yes, see my previous post.
    He replied:
    hello
    In your code ur mention IMAP port 888
    but by default its 143 so chk your server configuration for IMAP port no.

  • Problem in sending mail using java mail api

    This is the pogram I am using as of now to send a mail to yahoo id.
    import javax.mail.*;
    import javax.mail.internet.*;
    public class SendingMail2
    public SendingMail2()
    try
    String from = "ravikiran_sunrays";
    String to = "[email protected]";
    String subject = "the subject u wanna send ";
    String cc="[email protected]";
    String bcc="[email protected]";
    String text="the matter that u wanna send ";
    java.util.Properties prop = System.getProperties();
    prop.put("mail.smtp.host","mail.yahoo.com");
    //prop.put("http.proxyHost",System.getProperty("http.proxyHost"));
    //prop.put("http.proxyPort","8080");
    //prop.put("http.proxyPort",System.getProperty("http.proxyPort"));
    //prop.put("http.proxyHost","172.19.48.201");
    //System.getProperties().setProperty("http.proxyPort","8080");
    //System.getProperties().setProperty("http.proxyHost","172.19.48.201");
    Session ses = Session.getInstance(prop,null);
    MimeMessage message = new MimeMessage(ses);
    try
    Address fromAddress = new InternetAddress(from);
    message.setFrom(fromAddress);
    message.setSubject(subject);
    Address[] toAddress = InternetAddress.parse(to);
    Address[] cc_address=InternetAddress.parse(cc);
    Address[] bcc_address=InternetAddress.parse(bcc);
    message.setRecipients(Message.RecipientType.TO,toAddress);
    message.setRecipients(Message.RecipientType.CC,cc_address);
    message.setRecipients(Message.RecipientType.BCC,bcc_address);
    message.setSentDate(new java.util.Date());
    message.setText(text);
    Transport.send(message);
    System.out.println("Mail Successfully Sent");
    catch(Exception e)
    System.out.println("Problem " + e);
    catch(Exception e)
    System.out.println("Problem " + e);
    public static void main(String[] args)
    SendingMail2 sendingMail2 = new SendingMail2();
    This is the exception I am getting when I try 2 execute that program.
    avax.mail.SendFailedException: Sending failed;
    nested exception is:
         javax.mail.MessagingException: Unknown SMTP host: mail.yahoo.com;
    nested exception is:
         java.net.UnknownHostException: mail.yahoo.com

    listen buddy
    this is a class i made it is easy to understand it sends mails and check inbox just adduser from telnet with remote manager in james create the three accounts i am using and then use this class and its methods
    also the next class that contains the mails test my class and what i am saying
    import java.io.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class MailClient
    extends Authenticator
    public static final int SHOW_MESSAGES = 1;
    public static final int CLEAR_MESSAGES = 2;
    public static final int SHOW_AND_CLEAR =
    SHOW_MESSAGES + CLEAR_MESSAGES;
    protected String from;
    protected Session session;
    protected PasswordAuthentication authentication;
    public MailClient(String user, String host)
    this(user, host, false);
    public MailClient(String user, String host, boolean debug)
    from = user + '@' + host;
    authentication = new PasswordAuthentication(user, user);
    Properties props = new Properties();
    props.put("mail.user", user);
    props.put("mail.host", host);
    props.put("mail.debug", debug ? "true" : "false");
    props.put("mail.store.protocol", "pop3");
    props.put("mail.transport.protocol", "smtp");
    session = Session.getInstance(props, this);
    public PasswordAuthentication getPasswordAuthentication()
    return authentication;
    public void sendMessage(
    String to, String subject, String content)
    throws MessagingException
    System.out.println("SENDING message from " + from + " to " + to);
    System.out.println();
    MimeMessage msg = new MimeMessage(session);
    msg.addRecipients(Message.RecipientType.TO, to);
    msg.setSubject(subject);
    msg.setText(content);
    Transport.send(msg);
    public void checkInbox(int mode)
    throws MessagingException, IOException
    if (mode == 0) return;
    boolean show = (mode & SHOW_MESSAGES) > 0;
    boolean clear = (mode & CLEAR_MESSAGES) > 0;
    String action =
    (show ? "Show" : "") +
    (show && clear ? " and " : "") +
    (clear ? "Clear" : "");
    System.out.println(action + " INBOX for " + from);
    Store store = session.getStore();
    store.connect();
    Folder root = store.getDefaultFolder();
    Folder inbox = root.getFolder("inbox");
    inbox.open(Folder.READ_WRITE);
    Message[] msgs = inbox.getMessages();
    if (msgs.length == 0 && show)
    System.out.println("No messages in inbox");
    for (int i = 0; i < msgs.length; i++)
    MimeMessage msg = (MimeMessage)msgs;
    if (show)
    System.out.println(" From: " + msg.getFrom()[0]);
    System.out.println(" Subject: " + msg.getSubject());
    System.out.println(" Content: " + msg.getContent());
    if (clear)
    msg.setFlag(Flags.Flag.DELETED, true);
    inbox.close(true);
    store.close();
    System.out.println();
    ====================================
    testing this class
    =======================================
    public class JamesConfigTest
    public static void main(String[] args)
    throws Exception
    // CREATE CLIENT INSTANCES
    MailClient redClient = new MailClient("red", "localhost");
    MailClient greenClient = new MailClient("green", "localhost");
    MailClient blueClient = new MailClient("blue", "localhost");
    // CLEAR EVERYBODY'S INBOX
    redClient.checkInbox(MailClient.CLEAR_MESSAGES);
    greenClient.checkInbox(MailClient.CLEAR_MESSAGES);
    blueClient.checkInbox(MailClient.CLEAR_MESSAGES);
    Thread.sleep(500); // Let the server catch up
    // SEND A COUPLE OF MESSAGES TO BLUE (FROM RED AND GREEN)
    redClient.sendMessage(
    "blue@localhost",
    "Testing blue from red",
    "This is a test message");
    greenClient.sendMessage(
    "blue@localhost",
    "Testing blue from green",
    "This is a test message");
    Thread.sleep(500); // Let the server catch up
    // LIST MESSAGES FOR BLUE (EXPECT MESSAGES FROM RED AND GREEN)
    blueClient.checkInbox(MailClient.SHOW_AND_CLEAR);
    =======================================================
    it suppose to print this
    Clear INBOX for red@localhost
    Clear INBOX for green@localhost
    Clear INBOX for blue@localhost
    SENDING message from red@localhost to blue@localhost
    SENDING message from green@localhost to blue@localhost
    Show and Clear INBOX for blue@localhost
    From: green@localhost
    Subject: Testing blue from green
    Content: This is a test message
    From: red@localhost
    Subject: Testing blue from red
    Content: This is a test message
    thanks a lot
    but i need ur help plzzzzzzzzzzzz
    i can create account from telnet
    but how i can create a new account from java .. a jsp page that i made to create a new account on the server
    plzzzzzzzz help me
    bye

  • How to send e-mail using java mail api

    Hi can anyone tell me how to send mail using the javamail api, in short if possible an example code.

    Theres already lots of this code in the forums, use the search bar to the left.
    Also, there is a dedicated javaMail forum which you will find useful (you are currently in a JSP forum)
    http://forum.java.sun.com/forum.jspa?forumID=43

  • Sending HTML E Mail using Java Mail

    Can anybody please tell me how to send HTML email using JavaMail. I know I need the DataContentHandler for text/html mime type but where can I find one? If anybody has better suggestions you are welcome.

    Folks,
    I've used what you have suggested. Though it compiled, I kept getting this java error
    --Exception in MailServer.java
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.MessagingException: IOException while sending message;nested exception is:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/html
    at javax.mail.Transport.send0(Transport.java:204)
    at javax.mail.Transport.send(Transport.java:73)
    at MailTest.send(MailTest.java:419)
    at MailTest.sendThruDefaultServer(MailTest.java:319)
    at MailTest.main(MailTest.java:476)
    [sendEmail() - Exception  :javax.activation.UnsupportedDataTypeException
    HELP!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Rate and accessable value is not displaying for the tax invoice output

    Hello All,   Rate and accessable value is not displaying for the tax invoice output. Rest of all outputs for invoices shows Rate and accessable value. Scenerio is free of charge sales order (samples) removing the goods from pant so excise invoice has

  • Delayed/Slow Boot to DT, Program Delay

    Greetings, fellow Archers: I've been trying to find a solution to an inconvenience I've been having, and have so far been unable to come to a resolution.  My computer has been showing a delay/lag in going from cold to fully loaded Openbox ever since

  • FIM Object Visualizer for Synchronization Service

    Does this tool work if all we are running is the Synchronization Service?  It appears that it looks for the FIM Portal: $uri = "http://" + $args[0] + ":5725/resourcemanagementservice" I need to be able to extract my IAF and EAF settings.  There used

  • Need some help with Tic Tac Toe game

    hey. hope u guys can help me out... having a problem with my tic tac toe program... i have 2 problems. 1) got the "X" and "O" to appear using a flag(teacher didn't explain) using code like this if (jb == button[0]){ if (flag==0) button[0].setText("X"

  • Saving PDF files as Post Script files using Adobe Professional

    I have a 2 Page  PDf document that mainly has Text on each page. Both the Pages have a 2D Data Matrix Barcode also. I opened the PDF file in Adobe Professional and saved the file as Post Script file. Post Script file gets saved successfully. When I o