Please any one help

Hi,
I am trying to send a mail with attachment using jsp but I couldn't receive the attachment. My code is
try{
MimeMessage mm=new MimeMessage(session);
mm.setFrom(new InternetAddress(from));
mm.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to,false));
mm.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc,false));
mm.setRecipients(Message.RecipientType.BCC,InternetAddress.parse(bcc,false));
mm.setSubject(subject);
mm.setText(message);
Transport.send(mm);
// File attachment
File attach=new File(attachment);
System.out.println("This is the fileattached"+attachment);
if (attach.exists()){
MimeBodyPart mbp1=new MimeBodyPart();
mbp1.setText(message);
MimeBodyPart mbp2=new MimeBodyPart();
FileDataSource fds=new FileDataSource(attachment);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
Multipart mpt=new MimeMultipart();
mpt.addBodyPart(mbp1);
mpt.addBodyPart(mbp2);
mm.setContent(mpt);
}else{
mbp.setText(message);
Transport.send(mm);
System.out.println("Mail was successfully sent");
Kindly any one help me to fix the bug
Thanks for ur help
Regards,
Arunkumar

You are creating a File object called attach but passing attachment to the FileDataSource.
Take a look at the following:
               if (!attachmentFile.equals(testString))
                    int stringLength = attachmentFile.length();
                    int nameStart = attachmentFile.lastIndexOf("/");
                    nameStart = nameStart + 1;
                    String fileName = attachmentFile.substring(nameStart,stringLength);
                    String newFile = (attachmentPath + "/" + fileName);
                    File fileData = new File(newFile);
                    MimeBodyPart mbp2 = new MimeBodyPart();
                    FileDataSource fds = new FileDataSource(fileData);
                    DataHandler dh = new DataHandler(fds);
                    mbp2.setFileName(fileName);
                    mbp2.setDescription("Attached File:" + fileName);
                    mbp2.setDisposition(Part.ATTACHMENT);
                    mbp2.setDataHandler(dh);
                    mp.addBodyPart(mbp2);
               }

Similar Messages

  • While executing TCode F13 and F13E, purchase order number is not appearing.how it should be displayed into tcode f.13, please any one help me

    While executing TCode F13 and F13E, purchase order number is not appearing.how it should be displayed into tcode f.13, what are the requirements need to display into tcode f.13, please any one help me, i am facing this problem in  production server

    Hi Nattu,
    Please check it will show the PO no under Purchasing doc field
    Check which layout you are applied.
    its should be
    SAP&F124
    Without Specification of Crcy
    Regd,
    Khan.

  • I bought an iphone5 from saudi arabia,can i use it in india?is there any requirements i have to take?many one are saying i need to unlock it,please any one help me,i did'nt activate my phone yet.

    i bought an iphone5 from saudi arabia,can i use it in india?is there any requirements i have to take?many one are saying i need to unlock it,please any one help me,i did'nt activate my phone yet.

    If the phone is unlocked then you can use it in India.
    If your phone is locked, then the only way to get the phone unlocked is to contact your phone company/carrier. The person that sold you the phone in Saudi should have told you whether it was locked or unlocked.  Contact them to check and then contact the carrier to have it unlocked if it is locked.
    Other than that there is not a lot that you can do - perhaps it was unwise to purchase a phone in Saudi - it won't have Facetime on it if you got it there.

  • Please any one Help me

    Hi,
    I am prasanna.Please any one help me how to write case statement in dashboard prompt sql results.
    Thanks inadvance
    prasanna Undapalli

    Hi,
    While creating the dashboard prompts, you should be able to see 'Show' option which would have 'All Values' as Default. Change to SQL Results-
    For example- I have taken Customer Status from the samplesales RPD . So the result would come as -SELECT "D1 Customer"."C2 Cust Status" FROM "Sample Sales"
    Now modify the SQL as per requirement.
    For Example- SELECT case when 1=1 then 'YTD' else "D1 Customer"."C2 Cust Status" end FROM "Sample Sales"
    union SELECT case when 1=1 then 'QTD' else "D1 Customer"."C2 Cust Status" end FROM "Sample Sales"
    union SELECT case when 1=1 then 'MTD' else "D1 Customer"."C2 Cust Status" end FROM "Sample Sales"
    This is the syntax and in the 'Default to' put the 'YTD' as specific value so that the report shows the report for the 'YTD'.
    And dont forget to add presentation variable and refer them in the intermediate reports.
    Hope this should solve your problem.
    Regards
    MuRam

  • Hi help needed in Smart form using BAdi ( please any one help me )

    Hi,
        I am working in SRM.I am new to SRM and smartforms .My problem is I need to change the stndard smarform for BBP_BIDINV_BID into zprogram for The text for Published Bid Invitation email should read as:xxxxwith emp name and date,The text for email when Bid is rejected :XXXx,Accepted,Returned.I need to attch the text using BAdi's .So can any one help me how to find out the suitable BADi to this and please send me process to do the oject..
    thanks in advance.
       Regards
         Uday

    Hi,
    check this BADI :
    BBP_OUTPUT_CHANGE_SF
    Regards
    Appana

  • Please any one help me in this query

    i have 6 tables. in my object i have to transfer the data to the internal table i_vbrk. it must include the following fields from the respective fields
    vbrk   -  vbeln, vkorg, vtweg, fkdat,knumv
    vbrp   -  vbeln, matnr, aktnr, arktx, netwr, wavwr
    mara   -  matnr, extwg, matkl
    marc   -  matnr, mmsta
    marm   -  umrez, matnr
    konv   -  knumv, kschl, kposn, kbetr.
    please help me in joining the tables to one internal table

    Hi,
    data:begin of it_vbrk occurs 0,
    vbeln like vbrk-vbeln,
    vkorg like vbrk-vkorg,
    vtweg like vbrk-vtweg,
    fkdat like vbrk-fkdat,
    knumv like vbrk-knumv,
    end of it_vbrk.
    data:begin of it_vbrp occurs 0,
    vbeln like vbrp-vbeln,
    matnr like vbrp-matnr,
    aktnr like vbrp-aktnr,
    arktx like vbrp-arktx,
    netwr like vbrp-netwr,
    wavwr like vbrp-wavwr,
    end of it_vbrp.
    data:begin of it_mara occurs 0,
    matnr like mara-matnr,
    extwg like mara-extwg,
    matkl like mara-matkl,
    end of it_mara.
    data:begin of it_marc occurs 0,
    matnr like marc-matnr,
    mmsta like marc-mmsta,
    end of it_marc.
    data:begin of it_marm occurs 0,
    umrez like marm-umrez,
    matnr like marm-matnr,
    end of it_marm.
    data:begin of it_konv occurs 0,
    knumv like konv-knumv,
    kschl like konv-kschl,
    kposn like konv-kposn,
    kbetr like konv-kbetr,
    end of it_konv.
    select vbeln vkorg vtweg fkdat knumv
    from vbrk
    into table it_vbrk.
    select vbeln matnr aktnr arktx netwr wavwr
    from vbrp
    into table it_vbrp
    for all entries in it_vbrk
    where vbeln = it_vbrk-vbeln.
    select matnr extwg matkl
    from mara
    into table it_mara
    for all entries in it_vbrp
    where matnr = it_vbrp-matnr.
    select matnr mmsta
    from marc
    into table it_marc
    for all entries in it_mara
    where matnr = it_mara-matnr.
    select umrez matnr
    from marm
    into table it_marm
    for all entries in it_mara
    where matnr = it_mara-matnr.
    select knumv kschl kposn kbetr
    from konv
    into table it_konv
    for all entries in it_vbrk
    where knumv = it_vbrk-knumv.
    regards,
    sowjanya.

  • Hai please any one help me

    events parameters are pass by value (true or false).

    True
    When you declare an event, you can use the EXPORTINGaddition to specify parameters that are passed to the event handler. The parameters are always passed by value.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/71/a8a77955bc11d194aa0000e8353423/content.htm

  • I am trying to open a new account but it is asking me security questions from my ex wife account. i am using a differnt Apple ID and Email. please any one help

    i am opening a new account but it is asking me security questions that my ex wife set up on hers. I am using a different Apple id and differnt email.Very confused please help

    You've been hitten by Apple's recent SNAFU. I fear you are SoL until their pending investigation fiasco is over with.

  • Please any one help n this issue

    ive done a code
    aaa = window.showModalDialog(str,window,"dialogheight:280px;dialogwidth:380px;dialogleft:500px;dialogtop:500px;status: No;");
    the window should not be dragged to some other position.it should b static at the same position.

    hey ive mentioned only the line i got doubt. ive used that line of coding in my jsp page.ok r u clear

  • I have to add support company column to the query based on city,location id,country can you please any one help me on this

    select fu.user_id,
          fu.user_name,
          hcp_phone1.phone_number primary_phone_number ,
          hcp_phone1.last_update_date cnts_last_update_date,
          fu.last_update_date user_last_update_date,
          (select hcp_phone2.phone_number
          from ar.hz_contact_points hcp_phone2
          where hcp_phone2.contact_point_type(+) = 'PHONE'
          and hcp_phone2.status(+)               = 'A'
          and hp.party_id                        =hcp_phone2.owner_table_id(+)
          and hcp_phone2.owner_table_name(+)     ='HZ_PARTIES'
          and hcp_phone2.primary_flag            = 'N'
          and rownum                             = 1
          ) secondary_phone_number,
        (select hcp_email.email_address
        from ar.hz_contact_points hcp_email
        where hcp_email.contact_point_type(+) = 'EMAIL'
        and hcp_email.status(+)               = 'A'
        and hp.party_id                       =hcp_email.owner_table_id(+)
        and hcp_email.owner_table_name(+)     ='HZ_PARTIES'
        and hcp_email.primary_flag            = 'Y'
        ) email_address,
        hp.person_first_name ,
        hp.person_middle_name ,
        hp.person_last_name ,
        hp.party_name,
        hp.person_title ,(
      nvl(hp.address1,' ') ||
      nvl(hp.address2,' ') ||
      nvl(hp.address3,' ') ||
      nvl(hp.address4,' ')
    ) address1,
       hp.city,
        hp.state ,
        hp.country ,
        hp.postal_code,
      ' ' industry_group,
        from fnd_user fu,
        ar.hz_parties hp,
        fnd_user_resp_groups furg,
        fnd_responsibility_tl frt,
        ar.hz_contact_points hcp_phone1
      where hp.party_id                      =fu.person_party_id
      and furg.user_id                       =fu.user_id
    -- and ( to_date(fu.last_update_date,'dd-mm-yyyy') > to_date(nvl(p_in_date,sysdate),'dd-mm-yyyy')
    -- or to_date(hcp_phone1.last_update_date,'dd-mm-yyyy')> to_date(nvl(p_in_date,sysdate),'dd-mm-yyyy') 
      and furg.responsibility_id             = frt.responsibility_id
      and frt.responsibility_name            = 'EMR IBE Customer PSG US'
      and frt.language                       = 'US'
      and hcp_phone1.contact_point_type(+)   = 'PHONE'
      and hcp_phone1.status(+)               = 'A'
      and hp.party_id                        =hcp_phone1.owner_table_id(+)
      and hcp_phone1.owner_table_name(+)     ='HZ_PARTIES'
      and hcp_phone1.primary_flag            = 'Y';

    SELECT d.NAME
          FROM
            (SELECT jta.NAME
              FROM apps.jtf_terr_values_all jtva,
              apps.jtf_terr_qual_all jtqa,
              apps.jtf_terr_all jta ,
              apps.hz_party_sites ps,
              apps.hz_locations hl
            WHERE jtva.terr_qual_id     = jtqa.terr_qual_id
            AND jtqa.terr_id            = jta.terr_id
            AND jtva.low_value_char     = hl.postal_code
            AND jtqa.org_id             = jtva.org_id
            AND jta.org_id              = jtqa.org_id
            AND ps.location_id          = hl.location_id
            AND hl.country             in( 'CA', 'US')) D;
            UNION
            SELECT jta.NAME
              FROM apps.jtf_terr_values_all jtva,
              apps.jtf_terr_qual_all jtqa,
              apps.jtf_terr_all jta,
              apps.hz_party_sites ps,
              apps.hz_locations hl
            WHERE jtva.terr_qual_id     = jtqa.terr_qual_id
            AND jtqa.terr_id            = jta.terr_id
            AND ps.location_id          = hl.location_id
            AND jtqa.org_id             = jtva.org_id
            AND jta.org_id              = jtqa.org_id
            AND hl.country              = 'US'
            AND hl.postal_code BETWEEN jtva.low_value_char AND jtva.high_value_char
            )d;

  • While i integrate crystal And Jsp I got the Error messgae- any one help Me

    While i run my jsp ,i can view these error msg in server log file. please any one help to me....java.io.IOException: Unable to recover report source java.io.IOException: Unable to recover report source     at com.crystaldecisions.reports.reportengineinterface.JPEReportSource.readExternal(Unknown Source)
         at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1207)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:381)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231)
         at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1369)
         at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:864)
         at org.apache.catalina.session.StandardManager.load(StandardManager.java:440)
         at org.apache.catalina.session.StandardManager.start(StandardManager.java:655)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:3585)
         at org.apache.catalina.startup.HostConfig.checkWebXmlLastModified(HostConfig.java:614)
         at org.apache.catalina.startup.HostConfig.run(HostConfig.java:854)
         at java.lang.Thread.run(Thread.java:479)

    That sounds like the equivalent of a FileNotFoundException.
    ie you have told it the rpt file to load, and it can't find it.
    1 - check the spelling of the filename
    2 - where have you put the file?
    3 - What is your config for this?
    Do you have CRConfig.xml (Crystal 11) or CrystalReportEngine-config.xml(Crystal 10) in your WEB-INF/classes directory?
    That file tells it where to find the rpt files.
    I think the default is WEB-INF/lib for some reason.
    I keep my reports in the WEB-INF/reports directory
    Mine looks something like this:
    <?xml version="1.0" encoding="utf-8"?><CrystalReportEngine-configuration>
        <reportlocation>../reports</reportlocation>
        <timeout>10</timeout>     
    <keycode>[insert your keycode here]</keycode>
    </CrystalReportEngine-configuration>Hope this helps,
    evnafets

  • Any one help me... i have ipod touch4.... v5.1 i cant sign in at imessage

    please any one help me i cant sign in at facetime & imessage
    COULD NOT SIGN IN.. PLEASE CHECK YOUR NETWORK CONNECTION AND TRY AGAIN
    please help what to do thankyou

    Try:
    - Going to Settings>wifi and change DNS to Google's 8.8.8.8
    - Go to Settings>General>Time & Date abd set to automatic and make sure that he time zone is correct.

  • Hello, every one. Over the last few days I haven't been able to download any app from the app store. can any one help me, please?

    Over the last few days I haven't been able to download any app. can any one help me, please ? thank you.

    Andrea...
    You posted in the "Using Mac App Store" forum but your profile indicates you are using an iPad so that's what I'll try helping you with.
    On the iPad tap Settings > General > Reset > Reset Network Settings
    Then restart the iPad.  Hold the On/Off Sleep/Wake button down until the red slider appears. Slide your finger across the slider to turn off iPhone. To turn iPhone back on, press and hold the On/Off Sleep/Wake button until the Apple logo appears.
    If you still can't download apps, the problem may be your Wi-Fi connection >  iOS: Troubleshooting Wi-Fi networks and connections

  • Since itunes and apple tvs latest update I have had problem wtching movies on apple tv via my itunes can any one help, movie takes a very long time to load sometimes never, it use to work really well, whats going on please help?

    Since itunes and apple tvs latest update I have had problem wtching movies on apple tv via my itunes can any one help, movie takes a very long time to load sometimes never, it use to work really well, whats going on please help?

    You might find useful information in item D1 of Time Machine Troubleshooting.

  • Please help i started my project video format 720HD resolution 12x720 rate 25p at last when i finish and burn to dvd the edges are cut off any one help please i am really in trouble

    please help i started my project with  video format 720HD, resolution 12x720, rate 25p.  at last when i finish and burn to dvd the edges are cut off and my logo cut off the screeen aswell any one help please i am really in trouble. thanks

    Sorry, but I don't know anything about that app.
    I did go to their Web site and I see they have a support link. Perhaps you can get help there or in their forum.
    If you are OK with a DVD with a basic menu, you could try the Share>DVD option in FCP.
    Good luck.
    Russ

Maybe you are looking for

  • QM Sceneri: MIC which has it Limits dependent on the results of a MIC.

    QM Scenerio   The plan has multiple MIC's all with limits. First five MIC's are independent and rest three are having their limits dependent on the results of a MIC eg with a formula. say 0.8X lower limit and 1.1X upper limit of a MIC., where X is th

  • Boot Camp/Windows Partition

    I'm thinking of going the boot camp route so as to run a few of my windows programs and would be grateful for advice from users who have done this. Boot camp assistant seems to say 32Gb as standard for the win partition - has this been found to be re

  • ISE and machine authentication

    Hi I have ISE 1.1  : user authentication is working fine Now I need to implement machine authentication But I have 2 requirement 1- User must remove and plug his network cable as he want (without close windows session or restart his computer) and his

  • Java CAPS 5.1.3 edesigner problem?

    Hi, In my Business Process, i changed something in a business rule designer (changed return type from number to string) then build and deployed. But changes did NOT show up! Any suggestions please. thanks in advance.

  • Cash Flow  IN ORACLE APPLICATION

    dear Brother's What is the meaning of "CASH Flow"? How can handle it in oracle? Is a cash flow like any other report like balance sheet?