Need to attach a pdf stored in local system in a mail

Hi All,
I have a requirement where i need to attach a pdf file stored in my local system (D:\\Templates\\InquiryResponceform). In FileData Source i am giving the file path as shown below FileDataSource source = new FileDataSource("D:\\Templates\\InquiryResponceform.pdf");
When i am running the program it is sending the mail to the user but it is not attachning the pdf file.
Below is the code which i am using:
Properties properties = new Properties();
properties.put("mail.smtp.host","HYDPROJSMTP");
Session session = Session.getInstance(properties,null);
javax.mail.Message message=new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]"));
message.setRecipient(javax.mail.Message.RecipientType.TO,new InternetAddress("[email protected]"));
message.setSubject("TestMail");
MimeBodyPart messageBodyPart=new MimeBodyPart();
MimeBodyPart mimeBodyText=new MimeBodyPart();
FileDataSource source = new FileDataSource("D:\\Templates\\InquiryResponceform.pdf");
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName("InquiryResponceform.pdf");
mimeBodyText.setText("Hello");
Multipart multipart = new javax.mail.internet.MimeMultipart();
multipart.addBodyPart(messageBodyPart);
multipart.addBodyPart(mimeBodyText);
message.setContent(multipart);
message.setText("Hi This is testmail");
Transport.send(message);
Please let me know how to achieve this. Points guaranteed
Thanks in advance

Your mistake is here:
message.setContent(multipart);
message.setText("Hi This is testmail");The setText call overwrites everything that was done by the setContent call,
replacing the multipart content of the message with simple text content.

Similar Messages

  • Download of pdf to our local system by using classes in webdynpro abap

    hi,
    I createa an application ,in that i converted Smartform to Pdf.I want to download the generated pdf to our local system by using "cl_wd_runtime_services" because we cant directly use FM GUI_DOWNLOAD directly.So can any one please tell me the process.

    Hi ,
    see the below code..
    call function 'CONVERT_OTF'
          exporting
            format                = 'PDF'
          importing
            bin_filesize          = pdf_size
            bin_file              = LV_PDF
          tables
            otf                   = lt_otfdata[]
            lines                 = l_dummy
          exceptions
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            others                = 4.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.
    lv_string = filename
    cl_wd_runtime_services=>attach_file_to_response(
          i_filename  =  LV_STRING
          i_content   = lv_pdf
          i_mime_type = 'pdf/application'
          i_in_new_window = abap_false
          i_inplace       = abap_false ).
    this will open a popup same as when u download some file...
    Regards
    Yash

  • Need PL/SQL procedure for file transfer local system to server location

    Hi Experts,
    The requirement is one file ex: text file,excel file is there in Local system suppose c:newfolder/test.txt.
    once run the concurrent program for this particular file in the local system should transfer into server location for the mentioned path.
    is it possible to do in PL/SQL or shell script.
    can you please share the code.
    Thanks
    Meher

    Meher Irk wrote:
    The requirement is one file ex: text file,excel file is there in Local system suppose c:newfolder/test.txt.
    once run the concurrent program for this particular file in the local system should transfer into server location for the mentioned path.Why do you want to copy a local file from the local client file system, via the Oracle database server, to a remote directory on the server?
    Why is the Oracle database server to be used? For what purpose?
    There are standard secure methods for a client to copy a file to a server. Such as sftp and scp. No complex Oracle database server layer needed in-between.
    So why do you want to use the Oracle database to act as the copy mechanism for you?
    It will only make sense if the local file is copied into the database (as a LOB or securefile) and managed by the database. I fail to see why Oracle should be acting as the go-between for the client file system copy process to the server file system. This introduces another moving part in the copy process. Adds more security issues. Adds more authentication issues. And what for?

  • Need to print the pdf stored in unix which is a password protected

    Hi,
    Is there any command to print a pdf present inside a unix directory which is password protected?
    We tried installing pdftk and tried with some commands but we are unable to print the password protected pdf alone. Can anybody suggest which command must be used to print the password protected pdf in shell script??

    Which Linux OS are you using?
    Did you check the following: http://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/

  • Suddenly, I cannot attach a pdf file I created to an e-mail...

    Hi,
    Hope someone can help me. I've always created documents in Pages (sometimes just a page or two, with or without graphics or photos), saved them as a .pdf file and then attached them to an outgoing e-mail mainly so that the recipient cannot alter the content.
    However today for some reason, after saving the.pdf file, when I try to attach it to an outgoing e-mail (1 recipient only), I first get a drop down message saying "This file is not being sent in a secure format. Do you still want to send it ?" When I say yes, it takes forever to load until finally timing out and a message shows up on the e-mail where the file should have been saying that an error occured.
    I had no problem doing this yesterday or ever before, and I even tried attaching another document that attached fine yesterday, but today I'm getting this new message and the file doesn't load.
    Anyone know what's going on or how I can correct this ?
    The files are relatively small: 1 MB or less (one is only 32kb), and I had no problem attaching them in the past, in about 5 or 10 seconds. Only attaching 1 file per e-mail.
    Thanks for any advice.

    It now appears that all attachments - .pdf, photos, documents, etc. are coming up with this message when I try to attach them to my e-mails, and then cannot be attached (time out error message)....
    Could it be that my settings have changed somehow ? How do I checked what's changed and how do I fix this ?
    So frustrating as I have some urgent attachments to send out.
    Any help welcomed.

  • How to attach the PDF file in spool to an email?

    Dear friends,
        I need to attach the PDF file generated in the spool (SP01) to email.
    The PDF file is generated from VL02N at the time of Post Goods Issue .
    Thanks,
    Vidya.

    Hi,
    Refer to the link it is explained how to configure the output type to send the email with PDF attachment on saving the Billing Document.. you need to do the same way..
    Email Billing document as PDF Attachment while saving from VF01/02

  • How can I add the attachment list pdf file context to purchase order ?

    Dear all,
           I have use services for object in ME22N to attach PDF file to purchase order,I want to know how can I add the pdf file context to purchase order when I send the purchase order to vendor.
    Thanks in advance
    Best regards,
    Merry

    hi,
    attach document through Service for Object button. Service for Object button available down side of Command screen ( in your PO screen ME22N ) .
    Click your Service Object button -> Create -> Create attachment 
    then select your window directory ( which file you need to attach) select your file Now your system shows message  Service "Create attachment" is started. 
    Save again your PO. You can see (open) your attachment in same field ( Service for Object ) select and Create and check attachment list. You can attach as many document in your PO.

  • Can we attach a PDF file to a Smartform

    Hi Friends,
    I have a typical situation in which I need to attach a PDF file to the output of the smartform.  Can it be done ? If yes, then how. Kindly send me your valuable answers with correct examples.
    Or
    The PDF attachement can be printed alongwith the smartform?
    Regard,
    Pradeep

    hi ,
    we can attach the pdf file, pls go throug this example.
    DATA: formname TYPE  tdsfname,
          fm_name TYPE  rs38l_fnam,
          control_parameters TYPE ssfctrlop,
          job_output_info TYPE     ssfcrescl,
          otf_data TYPE tsfotf,
          bin_filesize TYPE i,
          otf TYPE TABLE OF itcoo WITH HEADER LINE,
          doctab_archive TYPE TABLE OF docs WITH HEADER LINE,
          lines TYPE TABLE OF tline WITH HEADER LINE.
    INITIALIZATION.
      formname = 'Z50818_TEST_SMARTFROM'.
    START-OF-SELECTION.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 = formname
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
       IMPORTING
         fm_name                  = fm_name
       EXCEPTIONS
         no_form                  = 1
         no_function_module       = 2
         OTHERS                   = 3
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      control_parameters-no_dialog = 'X'.
    control_parameters-preview = ''.
      control_parameters-getotf = 'X'.
      CALL FUNCTION fm_name
       EXPORTING
      ARCHIVE_INDEX              = ARCHIVE_INDEX
      ARCHIVE_INDEX_TAB          = ARCHIVE_INDEX_TAB
      ARCHIVE_PARAMETERS         = ARCHIVE_PARAMETERS
         control_parameters         = control_parameters
      MAIL_APPL_OBJ              = MAIL_APPL_OBJ
      MAIL_RECIPIENT             = MAIL_RECIPIENT
      MAIL_SENDER                = MAIL_SENDER
      OUTPUT_OPTIONS             = OUTPUT_OPTIONS
      USER_SETTINGS              = 'X'
       IMPORTING
      DOCUMENT_OUTPUT_INFO       = DOCUMENT_OUTPUT_INFO
         job_output_info            = job_output_info
      JOB_OUTPUT_OPTIONS         = JOB_OUTPUT_OPTIONS
       EXCEPTIONS
         formatting_error           = 1
         internal_error             = 2
         send_error                 = 3
         user_canceled              = 4
         OTHERS                     = 5
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      otf_data[] = job_output_info-otfdata[].
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
      EXPORTING
        USE_OTF_MC_CMD               = 'X'
        ARCHIVE_INDEX                = ARCHIVE_INDEX
       IMPORTING
         bin_filesize                 = bin_filesize
        TABLES
          otf                          = otf_data[]
          doctab_archive               = doctab_archive[]
          lines                        = lines
       EXCEPTIONS
         ERR_CONV_NOT_POSSIBLE        = 1
         ERR_OTF_MC_NOENDMARKER       = 2
         OTHERS                       = 3
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      DATA:  filename TYPE string.
      filename = 'c:\test\smart.pdf'.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
         bin_filesize                    = bin_filesize
          filename                        = filename
         filetype                        = 'BIN'
        APPEND                          = ' '
        WRITE_FIELD_SEPARATOR           = ' '
        HEADER                          = '00'
        TRUNC_TRAILING_BLANKS           = ' '
        WRITE_LF                        = 'X'
        COL_SELECT                      = ' '
        COL_SELECT_MASK                 = ' '
        DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = ' '
        NO_AUTH_CHECK                   = ' '
        CODEPAGE                        = ' '
        IGNORE_CERR                     = ABAP_TRUE
        REPLACEMENT                     = '#'
        WRITE_BOM                       = ' '
        TRUNC_TRAILING_BLANKS_EOL       = 'X'
        WK1_N_FORMAT                    = ' '
        WK1_N_SIZE                      = ' '
        WK1_T_FORMAT                    = ' '
        WK1_T_SIZE                      = ' '
      IMPORTING
        FILELENGTH                      = FILELENGTH
        TABLES
          data_tab                        = lines[]
        FIELDNAMES                      = FIELDNAMES
       EXCEPTIONS
         file_write_error                = 1
         no_batch                        = 2
         gui_refuse_filetransfer         = 3
         invalid_type                    = 4
         no_authority                    = 5
         unknown_error                   = 6
         header_not_allowed              = 7
         separator_not_allowed           = 8
         filesize_not_allowed            = 9
         header_too_long                 = 10
         dp_error_create                 = 11
         dp_error_send                   = 12
         dp_error_write                  = 13
         unknown_dp_error                = 14
         access_denied                   = 15
         dp_out_of_memory                = 16
         disk_full                       = 17
         dp_timeout                      = 18
         file_not_found                  = 19
         dataprovider_exception          = 20
         control_flush_error             = 21
         OTHERS                          = 22
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      DATA: document_data LIKE  sodocchgi1 ,
            contents_txt TYPE TABLE OF  solisti1  WITH HEADER LINE,
            contents_bin     TYPE TABLE OF     solisti1 WITH HEADER LINE,
            tab_lines TYPE i,
            packing_list TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
            OBJECT_HEADER type table of SOLISTI1 with header line,
            RECEIVERS     TYPE TABLE OF      SOMLRECI1 WITH HEADER LINE,     
            l_str(255) ,
            v1 TYPE i,
            v2 TYPE i,
            v3 type i.
      CONSTANTS: c_raw TYPE so_obj_tp VALUE 'RAW',
                 c_pdf TYPE so_obj_tp VALUE 'PDF',
                 c_255 TYPE i VALUE 255,
                 c_134 TYPE i VALUE 134,
                 C_X TYPE C VALUE 'X',
                 C_U TYPE C VALUE 'U'.
      document_data-obj_name = 'EMAIL'.
      document_data-obj_descr = 'subject'.
      contents_txt = 'THIS IS first line DATA'.
      APPEND contents_txt.
      CLEAR contents_txt.
      contents_txt = 'THIS IS second line DATA'.
      APPEND contents_txt.
      CLEAR contents_txt.
      APPEND contents_txt.
      APPEND contents_txt.
      DESCRIBE TABLE contents_txt LINES tab_lines.
      READ TABLE contents_txt INDEX tab_lines.
    document_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( contents_txt ).
      document_data-doc_size =  tab_lines .
      CLEAR packing_list-transf_bin.
      packing_list-head_start = 1.
      packing_list-head_num = 0.
      packing_list-body_start = 1.
      packing_list-body_num = tab_lines.
      packing_list-doc_type = c_raw.
      packing_list-doc_size = document_data-doc_size.
      APPEND packing_list.
      LOOP AT lines.
        CLEAR l_str.
        l_str+0(2) = lines-tdformat.
        l_str+2(132) = lines-tdline.
        v2 = v1 + c_134.
        IF v2 LE c_255.
          contents_bin-line+v1(c_134) = l_str. v1 = v2.
        ELSE.
          v3 = v2 - c_255.
          v2 = c_255 - v1.
          IF NOT v2 IS INITIAL.
            contents_bin-linev1(v2) = l_str0(v2).
          ENDIF.
          APPEND contents_bin.
          CLEAR contents_bin.
          v1 = v3.
          v3 = 134 - v1.
          IF NOT v1 IS INITIAL.
            contents_bin-line0(v1) = l_strv3(v1).
          ENDIF.
        ENDIF.
      ENDLOOP.
      APPEND contents_bin.
      CLEAR contents_bin.
      DESCRIBE TABLE contents_bin LINES tab_lines.
      READ TABLE contents_bin INDEX tab_lines.
    OBJECT_HEADER = 'objhead'.
    APPEND OBJECT_HEADER.
    packing_list-transf_bin = c_x.
    packing_list-head_start = 1.
    packing_list-head_num = 1.
    packing_list-body_start = 1.
    packing_list-body_num = tab_lines.
    packing_list-doc_type = c_pdf.
    packing_list-obj_name = 'text1'.
    packing_list-obj_descr = 'filename'.
    packing_list-doc_size = tab_lines * 255  + STRLEN( contents_bin ).
    APPEND packing_list.
    RECEIVERS-receiver = '[email protected]'.
    RECEIVERS-rec_type = c_u.
    APPEND RECEIVERS.
    CLEAR RECEIVERS.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data                    = document_data
       PUT_IN_OUTBOX                    = 'X'
      SENDER_ADDRESS                   = SY-UNAME
      SENDER_ADDRESS_TYPE              = 'B'
       COMMIT_WORK                      = 'X'
    IMPORTING
      SENT_TO_ALL                      =
      NEW_OBJECT_ID                    = NEW_OBJECT_ID
      SENDER_ID                        = SENDER_ID
      TABLES
        packing_list                     = packing_list
       OBJECT_HEADER                    = OBJECT_HEADER
       CONTENTS_BIN                     = CONTENTS_BIN
       CONTENTS_TXT                     = CONTENTS_TXT
      CONTENTS_HEX                     = CONTENTS_HEX
      OBJECT_PARA                      = OBJECT_PARA
      OBJECT_PARB                      = OBJECT_PARB
        receivers                        = receivers
    EXCEPTIONS
      TOO_MANY_RECEIVERS               = 1
      DOCUMENT_NOT_SENT                = 2
      DOCUMENT_TYPE_NOT_EXIST          = 3
      OPERATION_NO_AUTHORIZATION       = 4
      PARAMETER_ERROR                  = 5
      X_ERROR                          = 6
      ENQUEUE_ERROR                    = 7
      OTHERS                           = 8
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    hope this will solve u  r proble. reward if useull,dontforget.
    thanks
    fareedas

  • How to attach a PDF file ?

    Hi All,
    We need to attach a PDF file to each instance of Supplier Self registration page.
    For this we wanted to place our file on SAP server. But they only support applications/processes that reside on their application container.
    Is there any other way ?

    Hello,
    Rephrasing the above,
    I want to attach a PDF document in a page(for every instance).
    As our's is a Hosted system, we asked SAP to do so, but they don't place any external files.
    Did any of you face something like this?
    Can you please share some ideas.
    -Regards,
    Shubha Rao

  • How to upload a PDF-file and send it by SAP Mail

    Hi,
    we need to attach a pdf-file to an email send by SAP. The file is stored in a SAP-directory. When I use Open dataset to get the file it works but when sent by email the file could not be opened. I guess that perhaps I have to use other parameters to get the PDF in a correct file but I don't know which ones. Here is part of the coding I use for testing:
    TYPES: BEGIN OF typ_pdf,
           line(255),
           END OF typ_pdf.
    DATA: it_pdf TYPE STANDARD TABLE OF typ_pdf,
          wa_pdf LIKE LINE OF it_pdf.
    v_file = '/pool//Test.pdf'.
    OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
    WHILE ( sy-subrc EQ 0 ).
      READ DATASET v_file INTO wa_pdf.
      IF NOT wa_pdf IS INITIAL.
        APPEND wa_pdf TO it_pdf.
      ENDIF.
      CLEAR wa_pdf.
    ENDWHILE.
    CLOSE DATASET v_file.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data             = gd_doc_data
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list                  = it_packing_list
        contents_bin               = it_pdf
        receivers                  = it_receivers
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    Regards
    Nicola

    Hi Nicola,
    read the pdf from dataset as binary into an XSTRING.
    use function to convert xstring to table.
    Do not use SO_DOC.. function but CL_BCS (see blog 'unknown thus unloved'
    Regards,.
    Clemens

  • How to configure Dotmatrix Printer in local system

    Hi,
    I need to configure DOT MATRIX Printer in Local System in ECC6.0. please give steps how to configure.
    Thanks,
    venkat

    This is not more different than other printers.
    check
    http://help.sap.com/saphelp_nw70/helpdata/EN/7e/36e4c4023411d399b70000e83dd9fc/frameset.htm
    Markus

  • Provision to attach JPG, PDF or word file in module pool program

    Hi All,
    I am creating a Z-transaction with create, change and display options. The user needs 2 to 3 fields where he/she can attach a google map or a pdf or a word file. Could anyone please suggest how I can go about this such that during creation process the user can attach a file and then the same is displayed in the display screen and a click on that could lead to opening of the map or the pdf file stored on the system. If anyone has done the same, cud you please provide the code also.
    Regards,
    BP.

    First of all you need to create a conatiner on screen then
    for displaying word document you need to refer class CL_GUI_DOCUMENTS. 
    Sample code :
    data: custom_container type ref to cl_gui_custom_container,
          word_doc         type ref to cl_gui_documents.
    *&&custom container--
      create object custom_container
                     exporting container_name = 'CUST_CONT'.
      create object word_doc
        exporting
          parent            = custom_container
       SHELLSTYPE        =
       LIFETIME          =
        exceptions
          cntl_error        = 1
          cntl_system_error = 2
          create_error      = 3
          lifetime_error    = 4
          others            = 5
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    call method word_doc->open_document
      exporting
       GUID                  =
       GUIDTOUSE             = SPACE
       DOCUMENT_ID           =
       CONTREP_ID            =
        document_class        = 'WORDPRO.APPLICATION'
       OBJECT_TYPE           =
       OBJECT_ID             =
       DOCUMENT_TYPE         = 'WORD.BASIC'
      exceptions
        implace_not_supported = 1
        others                = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    for PDF document you need to refer class  CL_GUI_PDFVIEWER
    Sample code : refer to program SAP_PDF_VIEWER_DEMO

  • How to allow user to select pdf file on local machine and populate field with file name only

    Folks,
    I have a project requirement that I am stumped on.  I am admittedly a novice, so forgive questions that may seem obvious.
    My requirement is a form running on a client system where the user can click a button and select a PDF file name from a PDF on their local machine and then populate a form field with that file path & filename.  The file names vary between all machines, so there is no static list.  Note that the PDF is not embedded, nothing is executed, I simply need the file name.
    There are several of these on a form (20+), so manual name entry is too error prone.   I would like to use a 'browse' type dialog, but can not figure out how to implement it.
    I've looked at app.browseForFile, but the users can not install a javascript file in their adobe folder or any other files;  the functionality has to be integral with the original PDF. 
    Functionally, this is no different from the image object file browse, except that I need a PDF instead of an image file, so there doesn't seem like there should be a security issue that is any different from those surrounding the image object.
    I've been stumped on this for the entire week, and I have a deadline rapidly approaching, so any examples or suggestions (please remember I'm a novice) would be greatly appreciated! 

    Thanks for the reply Paul - do you have any sample code of how to attach the PDF?  Or how the user can select a PDF to open?  I might be able to attach it, retrieve the file name, and then un-attach it.
    Alternatively, do you know how to retrieve the file name from the imagePath object?  It will let you select PDF files, but I can't find info on how to retrieve the file name.   It should be the way you would retrieve the file name for an image.
    As a novice in this, thanks for your help and patience!

  • Attaching a pdf document while sending email

    Hi,
    Can you help me to send a pdf as an attachment while sending mail.
    Also plz tell me the required configuration changes that need to be done.

    It is important that where is your file which you are trying to attach and how you are creating the File object out of it to pass it to the MimeMessageUtils.setContent(). As such there is no specific location to place the the file you just need to create its File object correctly. E.g. if your PDF is getting created through some other application and it is present in say C:\app\output\pdf or /usr/local/app/output/pdf then what you can do is set a Java system property (let's name the system property as file.attach.dir) through your server startup scripts with like -Dfile.attach.dir=C:\\app\\output\\pdf or -Dfile.attach.dir=/usr/local/app/output/pdf
    And then in your code you can do something like:
    File attachment = new File(System.getProperty("file.attach.dir") + File.separatorChar + "attachment.pdf");
    MimeMessageUtils.setContent(message, content, attachment, false);
    You may also place the attachment files in an ATG specific folder and access it using atg.nucleus.DynamoEnv. Say the file is within a directory called "attachments" in the ATG data directory which defaults to <ATG>\home in case of a non-standalone EAR so you can do
    File attachment = new File(atg.nucleus.DynamoEnv.getDataDir().getPath() + File.separatorChar + "attachments" + File.separatorChar + "attachment.pdf");
    MimeMessageUtils.setContent(message, content, attachment, false);
    If you make and deploy the EAR on application server as standalone then you might already have the ATG data directory set to some location through system property -Datg.dynamo.data-dir in your server startup scripts. So if that is the case you may use this same property as mentioned above in the first approach.
    You can always check the file path and whether it is getting properly resolved by using Java File APIs like file.getPath() and file.exists() where file is the File object that you created. Make sure that file.exists() returns you true and you will not encounter FileNotFound Exception.

  • I have to attach a pdf which i get from spool and also attach some files

    hi , i have requirement where i have to send a pdf as attachment , this pdf is generated throught the spool request , along with this pdf i need to attach some files from the presentation server, i am using the fm SO_OBJECT_SEND, but the problem is in the mail i get the attchment from the presentation server only , while the pdf content which are stored in the objcont are not received, when i comment the folder_id part in the FM i get the PDF attachment, can any one help me know what is the reson and how can i solve this, ur suggestion will be very helpful.kindly suggest

    That's an Outlook issue. You'll probably get better responses posting on the Office for Mac forums.

Maybe you are looking for

  • Fried My iPod with Auto Charger

    Hey, My car charger actually sparked at the bottom port of the iPod, and left smoky residue there (probably fried some connectors and circuits - there was actually a smoky smell). It immediately made my iTrip inoperable. Now I bought a new iTrip, but

  • Emkey is not valid , how do i fix that?

    /u01/app/oracle/product/gc/oms10g> /u01/app/oracle/product/gc/oms10g/bin/_emctl config emkey -repos_ Oracle Enterprise Manager 10g Release 5 Grid Control Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved. Please enter repository passwo

  • Unable to restore database using RMAN in oracle 10g

    Hi Everyone!!!!!!! I have following scenario. In which I don't want to drop newly created tablespace (test). So, let me know how to restore database from existing backup without dropping new tablespace and taking new backup? 1. I took database backup

  • If I accidently open an app and immediately close it down, it keeps reopening. Why?

    If I accidentally open an application, and I go to shut it down immediately, it automatically re-opens itself. It repeats and repeats until I let it complete the opening process. Does anybody have this problem? And if yes, have you resolved it? Thank

  • Problem in Dequeuing from AQ Adapter

    I Have Problem in Dequeuing my BPEL Process is able enqueue the message to B2B but it is not able to Dequeue the same message from the Queue. Interesting point some times My process is able to Dequeue the message and some time it is not able to Deque