File to Mail with multiple attachments

Hi All,
I am doing file to mail scenario in which iam including attachments.
I am able to send one attachment(i.e., .txt) from file to mail.
My requirement is i need to send both .txt and .xls .Please let me know the procedure for sending multiple attachments(probabaly without any abap coding or .jar files usage).
regards
Madhu

Hi Madhu,
     Using the default modules PayloadSwapBean and MessageTransformBean you can able to send multiple attachments.
swap.keyName  :payload-name or payload-description or content-type, content-description. swap.keyValue: If you have  a multiple attachments then give the multiple key value.
Like you have payload name
  Attachment1, Attachment2 then
swap.keyName  payload-name
swap.keyValue  Attachment1, Attachment2
Using the MessageTransformBean you can able to change the file name.
PayloadSwapBean:
[http://help.sap.com/saphelp_nw70/helpdata/EN/2e/bf37423cf7ab04e10000000a1550b0/content.htm]
MessageTransformBean:
[http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
Regards,
Prakasu

Similar Messages

  • Sending mail with multiple attachments

    hi.I wrote a code to send mail.but i need to send mail with multiple attachments.here is the code i wrote.what should i do to send the mail with multiple attachments.if i run this code iam able to send mails but not attachments.please help me
    <%@ page import="javax.mail.*,javax.mail.internet.*,java.util.Date,java.io.*,java.net.InetAddress,java.sql.*,java.util.Properties,java.net.*,javax.sql.*,javax.activation.*,java.util.*,java.text.*" %>
    <%@ page import="java.io.*,java.sql.*,java.net.*,java.util.*,java.text.*" %>
    <%
         String Attachfiles1="";
         String Attachfiles2="";
    String Attachfiles3="";
    if("Send".equalsIgnoreCase("send"))
              try
         String subject="",from="",url = null,to="";
         String mailhost = "our local host";
         Properties props = System.getProperties();
         String msg_txt="";
         String strStatus="";
    // byte[] bin=.....;
    //Adds Attechment:
    Multipart multipart = new MimeMultipart();
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setText("Here are my attachments");
    multipart.addBodyPart(messageBodyPart);
    messageBodyPart = new MimeBodyPart();
    //first attachment
    DataSource source = new FileDataSource("C:\\img1.jpg");
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName("C:\\Telnor1.jpg");
    multipart.addBodyPart(messageBodyPart);
    //Second attachment
    DataSource source2 = new FileDataSource("C:\\img2.jpg");
    messageBodyPart.setDataHandler(new DataHandler(source2));
    messageBodyPart.setFileName("C:\\Telnor2.jpg");
    multipart.addBodyPart(messageBodyPart);
    //etc...
    message.setContent(multipart);
    Transport.send( message );
    String mailer = "MyMailerProgram";
    to=request.getParameter("to");
    from=request.getParameter("from");
    subject=request.getParameter("subject");
    msg_txt=request.getParameter("message");
    props.put("mail.smtp.host", mailhost);
    Session mailsession = Session.getDefaultInstance(props, null);
    Message message = new MimeMessage(mailsession);
    message.setFrom(new InternetAddress(from));
    message.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
    message.setSubject(subject);
    message.setHeader("X-Mailer", mailer);
    message.setSentDate(new Date());
    message.setText(msg_txt);
    BodyPart messageBodyPart = new MimeBodyPart();
    BodyPart messageBodyPart2 = new MimeBodyPart();
    Multipart multipart = new MimeMultipart(); // to add many part to your messge
    messageBodyPart = new MimeBodyPart();
    javax.activation.DataSource source = new javax.activation.FileDataSource("path of the file");
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName("file_name");
    messageBodyPart2.setText("message"); // set the txt message
    multipart.addBodyPart(messageBodyPart);
    multipart.addBodyPart(messageBodyPart2);
    Transport.send(message);
    out.println("Message Sent");
    catch (Exception e)
    e.printStackTrace();
    if("Attachfiles".equalsIgnoreCase("attachfiles"))
    Attachfiles1=request.getParameter("fieldname1");
    Attachfiles2=request.getParameter("fieldname2");
    Attachfiles3=request.getParameter("fieldname3");
    %>
    <html>
    <body>
    <div class="frame">
         <form action="Composemail.jsp" method="post">
              <b>SelectPosition:</b> <select name="cars" >
    <option value="ABAP">ABAP
    <option value="saab">Saab
    <option value="fiat">Fiat
    <option value="audi">Audi
    </select><br><br>
    <table border="1" cellpadding="2" cellspacing="2">
    <tr><th>Name</th>
    <th>EmailId</th>
    <th>ContactNumber</th>
    <th>Position</th>
    </tr>
    <tr>
    <td>
    </td>
    </tr>
    </table><br>
    <b>SelectUser :</b><select name="cars">
    <option value="Administrator">Administrator
    <option value="saab">Saab
    <option value="fiat">Fiat
    <option value="audi">Audi
    </select>
    <br>
    <b>To :</b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="to" size="72"><br>
    <b>From :</b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="from" size="72"><br>
    <b>Subject :</b>&nbsp&nbsp&nbsp<input type="text" name="subject" size="72"><br>
    <%=Attachfiles1%><br><%=Attachfiles2%><br><%=Attachfiles3%><br><br>
    <b>Message:</b><br>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<textarea rows="10" cols="50" name="message">
    </textarea> <br><br>
    <b>AttachedFile:</b>&nbsp<input type="file" name="fieldname1" value="filename" size="50"><br><br>
    <b>AttachedFile:</b>&nbsp<input type="file" name="fieldname2" value="filename" size="50"><br><br>
    <b>AttachedFile:</b>&nbsp<input type="file" name="fieldname3" value="filename" size="50"><br><br>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="submit" name="attachfiles" value="Attachfiles">
    <center>
    <input type="submit" name="send" value="Send" >
    </center>
    </form>
    </div>
    </body>
    </html>

    Create a separate MimeBodyPart object for each attachment, rather than reusing
    the same one over and over.

  • Sending mail with multiple attachments in jsp

    hi .I wrote a code to send a mail in jsp.but now i need to send mails with multiple attachments.how can i send mail with multiple attachment.

    Create a separate MimeBodyPart object for each attachment, rather than reusing
    the same one over and over.

  • SAP PI7.31 : Mail with multiple attachments - how to process via UDF

    Hi
    wondering how I can approach this problem.   I have to read an Email with any number of attachments  - it can have between 1 and 4 or maybe more of different types (CSV,XLS,PDF,ZIP).  I need to read this email and extract the attachments to a folder.
    Just to let you know I have done this OK for an email that I know only has 2 attachments ! Works perfectly - just no good for ?n? attachments !
       Mail Sender has AF_Modules/MultipartHeaderBean to add payload Attributes
       The message is sent to 2 Receivers
       Each Receiver File adapter then uses AF_Modules/DynamicConfigurationBean and AF_Modules/PayloadSwapBean
    Problem is that when I do not know how many attachments there are.  So I will have to write a Java UDF mapping, perhaps using the classTransformationInput.
    My question is : To create a Java UDF what should be structure of a sent Email message Type look like so I can feed that into a UDF to check what payload attachments there are etc ?.

    As long as you use java mapping, you can have any dummy structures for your interfaces.
    But, if you prefer to use graphical mapping with UDF, then you should have some valid structures for your mail and file interfaces. e.g., mail pack XSD for mail interface as metioned by Indrajit Sarkar
    and again the same structure for the file interface as well so that you can have one to one mapping an then make use of UDF code from the article. Use payload swap bean in the receiver file channel to replace xml payload with Zipped attachments and then finally use script to unzip this zip file.
    Rgds,
    Praveen Gujjeti

  • Sending UTL_SMTP mail with Multiple attachment

    Hi,
    My Environment ----> Oracle Database 11g r1 on Windows 2003 Server (64Bit).
    The below script i used for sending mail with single attachment now i am trying to send mail with multiple attachment please tell me how to achieve this
    DECLARE
    /*LOB operation related varriables */
    v_src_loc BFILE := BFILENAME('DATA_PUMP_DIR', 'EXPORT.LOG');
    l_buffer RAW(54);
    l_amount BINARY_INTEGER := 54;
    l_pos INTEGER := 1;
    l_blob BLOB := EMPTY_BLOB;
    l_blob_len INTEGER;
    v_amount INTEGER;
    /*UTL_SMTP related varriavles. */
    v_connection_handle UTL_SMTP.CONNECTION;
    v_from_email_address VARCHAR2(30) := '[email protected]';
    v_to_email_address VARCHAR2(30) := '[email protected]';
    v_smtp_host VARCHAR2(30) := 'MAIL.EXPORT.COM'; --My mail server, replace it with yours.
    v_subject VARCHAR2(30) := 'MULTIPLE Attachment Test';
    l_message VARCHAR2(200) := 'TEST Mail for Multiple Attachment';
    /* This send_header procedure is written in the documentation */
    PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
    BEGIN
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    pi_name || ': ' || pi_header || UTL_TCP.CRLF);
    END;
    BEGIN
    /*Preparing the LOB from file for attachment. */
    DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
    DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
    v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
    DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
    l_blob_len := DBMS_LOB.getlength(l_blob);
    /*UTL_SMTP related coding. */
    v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
    UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
    UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
    UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
    UTL_SMTP.OPEN_DATA(v_connection_handle);
    send_header('From', '"Sender"');
    send_header('To', '"Recipient"');
    send_header('Subject', v_subject);
    --MIME header.
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'MIME-Version: 1.0' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    ' boundary= "' || 'SAUBHIK.SECBOUND' || '"' ||
    UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    -- Mail Body
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Type: text/plain;' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    ' charset=US-ASCII' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    -- Mail Attachment
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Type: application/octet-stream' ||
    UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    ' filename="' || 'export.log' || '"' || --My filename
    UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    /* Writing the BLOL in chunks */
    WHILE l_pos < l_blob_len LOOP
    DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
    UTL_SMTP.write_raw_data(v_connection_handle,
    UTL_ENCODE.BASE64_ENCODE(l_buffer));
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    l_buffer := NULL;
    l_pos := l_pos + l_amount;
    END LOOP;
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    -- Close Email
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    '--' || 'SAUBHIK.SECBOUND' || '--' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
    UTL_SMTP.CLOSE_DATA(v_connection_handle);
    UTL_SMTP.QUIT(v_connection_handle);
    DBMS_LOB.FREETEMPORARY(l_blob);
    DBMS_LOB.FILECLOSE(v_src_loc);
    EXCEPTION
    WHEN OTHERS THEN
    UTL_SMTP.QUIT(v_connection_handle);
    DBMS_LOB.FREETEMPORARY(l_blob);
    DBMS_LOB.FILECLOSE(v_src_loc);
    RAISE;
    END;
    Thank you
    Shan

    Hi Saubhik
    Thanks for your reply, below script i used to send mail with multiple attachments, plsql code is executing without any error messages and i am also able to receive mail with the multiple attachment.
    i used your code which u posted in OTN then i changed little bit as per my need, output is ok.but the problem is if i want to add one more file then i have to add more varaiables in the code. i want to make the code which i can add more attachments without adding more varaiables i don't know the way to do this. can u please give me some hints.
    Thanks for your help
    Shan
    Script Used:
    DECLARE
    /*LOB operation related varriables01 */
    v_src_loc BFILE := BFILENAME('DATA_PUMP_DIR', 'EXPORT.LOG');
    l_buffer RAW(54);
    l_amount BINARY_INTEGER := 54;
    l_pos INTEGER := 1;
    l_blob BLOB := EMPTY_BLOB;
    l_blob_len INTEGER;
    v_amount INTEGER;
    /*LOB operation related varriables02 */
    v_src_loc2 BFILE := BFILENAME('DATA_PUMP_DIR', 'EXPORT1.LOG');
    l_buffer2 RAW(54);
    l_amount2 BINARY_INTEGER := 54;
    l_pos2 INTEGER := 1;
    l_blob2 BLOB := EMPTY_BLOB;
    l_blob_len2 INTEGER;
    v_amount2 INTEGER;
    /*UTL_SMTP related varriavles. */
    v_connection_handle UTL_SMTP.CONNECTION;
    v_from_email_address VARCHAR2(30) := '[email protected]';
    v_to_email_address VARCHAR2(30) := '[email protected]';
    v_smtp_host VARCHAR2(30) := 'MAIL.EXPORT.COM'; --My mail server, replace it with yours.
    v_subject VARCHAR2(30) := 'MULTIPLE Attachment Test';
    l_message VARCHAR2(200) := 'TEST Mail for Multiple Attachment';
    /* This send_header procedure is written in the documentation */
    PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
    BEGIN
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    pi_name || ': ' || pi_header || UTL_TCP.CRLF);
    END;
    BEGIN
    /*Preparing the LOB from file for attachment01. */
    DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
    DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
    v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
    DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
    l_blob_len := DBMS_LOB.getlength(l_blob);
    /*Preparing the LOB from file for attachment02. */
    DBMS_LOB.OPEN(v_src_loc2, DBMS_LOB.LOB_READONLY); --Read the file
    DBMS_LOB.CREATETEMPORARY(l_blob2, TRUE); --Create temporary LOB to store the file.
    v_amount2 := DBMS_LOB.GETLENGTH(v_src_loc2); --Amount to store.
    DBMS_LOB.LOADFROMFILE(l_blob2, v_src_loc2, v_amount2); -- Loading from file into temporary LOB
    l_blob_len2 := DBMS_LOB.getlength(l_blob2);
    /*UTL_SMTP related coding. */
    v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
    UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
    UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
    UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
    UTL_SMTP.OPEN_DATA(v_connection_handle);
    send_header('From', '"Sender"');
    send_header('To', '"Recipient"');
    send_header('Subject', v_subject);
    --MIME header.
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'MIME-Version: 1.0' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    ' boundary= "' || 'SAUBHIK.SECBOUND' || '"' ||
    UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    -- Mail Body
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Type: text/plain;' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    ' charset=US-ASCII' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    -- Mail Attachment01
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Type: application/octet-stream' ||
    UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    ' filename="' || 'export.log' || '"' || --My filename
    UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    /* Writing the BLOL in chunks */
    WHILE l_pos < l_blob_len LOOP
    DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
    UTL_SMTP.write_raw_data(v_connection_handle,
    UTL_ENCODE.BASE64_ENCODE(l_buffer));
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    l_buffer := NULL;
    l_pos := l_pos + l_amount;
    END LOOP;
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    -- Mail Attachment02
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Type: application/octet-stream' ||
    UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    ' filename="' || 'export1.log' || '"' || --My filename
    UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    /* Writing the BLOL in chunks */
    WHILE l_pos2 < l_blob_len2 LOOP
    DBMS_LOB.READ(l_blob2, l_amount2, l_pos2, l_buffer2);
    UTL_SMTP.write_raw_data(v_connection_handle,
    UTL_ENCODE.BASE64_ENCODE(l_buffer2));
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    l_buffer2 := NULL;
    l_pos2 := l_pos2 + l_amount2;
    END LOOP;
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    -- Close Email
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    '--' || 'SAUBHIK.SECBOUND' || '--' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
    UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
    UTL_SMTP.CLOSE_DATA(v_connection_handle);
    UTL_SMTP.QUIT(v_connection_handle);
    DBMS_LOB.FREETEMPORARY(l_blob);
    DBMS_LOB.FILECLOSE(v_src_loc);
    DBMS_LOB.FREETEMPORARY(l_blob2);
    DBMS_LOB.FILECLOSE(v_src_loc2);
    EXCEPTION
    WHEN OTHERS THEN
    UTL_SMTP.QUIT(v_connection_handle);
    DBMS_LOB.FREETEMPORARY(l_blob);
    DBMS_LOB.FILECLOSE(v_src_loc);
    DBMS_LOB.FREETEMPORARY(l_blob2);
    DBMS_LOB.FILECLOSE(v_src_loc2);
    RAISE;
    END;
    PL/SQL procedure successfully completed.
    Edited by: SHAN2009 on May 11, 2011 1:05 PM

  • File to Mail with content as excel attachment

    Hi there,
    Can somebody please guide me in achieving this goal.
    I have a requirement in which I have to send the email content as an excel attachment which is very new to me.
    Requirement
    File.............XI............Mail
    Sender File: xyz.xml
    Mapped with standard mail.xsd and concat all the requested filed to the content but now the requirement is changed and I need to send the content as an excel attachment.
    I don't know JAVA & ABAP and this is the first time I am using mail adapter.
    Can somebody please guide me how to achieve this.
    In Another interface I have to send the source file name as a mail attachment, By Default mail adapter send the filename as untitled.
    Is there easy way to changed the name of the attachment to the source file name.
    File ............... XI.........Mail.
    Source file: xyz.xml
    No mapping required just send the file to the mail adapter but condition is that the file name should be the same.
    Mail (Attachment: xyz.xml)
    Please can somebody suggest me how to achieve this.
    Thanks,

    Hi,
    Please refer the blogs given which help you a lot regarding your requirement.
    /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    /people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
    /people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    /people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

  • Sending email with multiple attachments

    Hi forum,
    I am able to send email with a single attachment using maildemo.sql from: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    But now I am trying to send email with more than 1 attachment and it does not work. My code that calls the above mentioned package is as follows:
    <code>
    PROCEDURE send (
    psender VARCHAR2,
    precipients VARCHAR2,
    pcc VARCHAR2,
    pbcc VARCHAR2,
    psubject VARCHAR2,
    pmessage VARCHAR2,
    pnumattach NUMBER) -- The number of attachments that need to be sent
    IS
    p_blob BLOB;
    p_filename VARCHAR2(200);
    p_filetype VARCHAR2(200);
    p_currSeq NUMBER;
    conn utl_smtp.CONNECTION;
    i NUMBER;
    j NUMBER;
    len NUMBER;
    BEGIN
    IF pnumattach > 1
    THEN
    conn := SEND_EMAIL_HELPER.begin_mail(
              sender => psender,
              recipients => precipients,
              subject => psubject,
              mime_type => send_email_helper.MULTIPART_MIME_TYPE);
    j := 0;
    SELECT seq_attach_transact_id.CURRVAL INTO p_currSeq FROM dual; -- seq_attach_transact_id is a primary key that identifies every single attachment in the table
    WHILE (j < pnumattach) LOOP
    p_currSeq := p_currSeq - j;
    SELECT blob_content INTO p_blob FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SELECT name INTO p_filename FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SELECT mime_type INTO p_filetype FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SEND_EMAIL_HELPER.begin_attachment(
    conn => conn,
    mime_type => p_filetype,
    inline => TRUE,
    filename => p_filename,
    transfer_enc => 'base64');
    -- split the Base64 encoded attachment into multiple lines
    i := 1;
    len := DBMS_LOB.getLength(p_blob);
    WHILE (i < len) LOOP
    IF(i + SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH < len)THEN
    UTL_SMTP.Write_Raw_Data (conn,
    UTL_ENCODE.Base64_Encode(
    DBMS_LOB.SUBSTR(p_blob, SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH, i)));
    ELSE
    UTL_SMTP.Write_Raw_Data (conn,
    UTL_ENCODE.Base64_Encode(
    DBMS_LOB.SUBSTR(p_blob, (len - i)+1, i)));
    END IF;
    UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
    i := i + SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH;
    END LOOP;
    SEND_EMAIL_HELPER.end_attachment(conn => conn);
    END LOOP;
    SEND_EMAIL_HELPER.attach_text(
    conn => conn,
    data => pmessage,
    mime_type => 'text/html');
    SEND_EMAIL_HELPER.end_mail( conn => conn );
    ELSE
    utl_mail.send(psender,precipients,pcc,pbcc,psubject,pmessage);
    END IF;
    END send;
    </code>
    Can anyone please tell me where am i going wrong.
    Message was edited by:
    Monk

    The easiest is to send an e-mail with multiple attachments to yourself and then view the message in raw to see how it is formatted - how the boundaries work. what the boundary headers are, etc.
    Then you use that as a template for your PL/SQL code to generate a MIME body for an e-mail that has multiple attachments.
    To debug.. have your PL/SQL code send sample e-mails with multiple attachment to your account, view it in raw format and compare that to the original format you've based your template on.
    And none of this is really a PL/SQL issue.. it is all about formatting a valid MIME message for an e-mail.

  • How to send the mail with multiple file attachments ?

    Sending mails with multiple files as attachments.

    You need to start from the app, assuming that it has an email function, that contains the files that you want to send as attachments. The Photos app allows you to send up to 5 photos on the same email, but if you want to send multiple file types then you need an app that supports all those file types. I use the GoodReader app which supports quite a few document/file types (e.g. PDF, Excel, Word, pictures), and from that I can select multiple files (including different types) and attach them to the same email.

  • Sending mail with multiple attachment

    hi.
    i want to send mail with multiple attachment.
    i m succeed in sending multiple attachment but the second pdf is not open.
    its given error like "This file is damaged and could not be open.
    pls check my code. and
    give the solution....
    point should be assured...........
    hope all u r understand my problem..
    & tell me where is i m missing something.
    REPORT  YSDPASALE1_MAIL LINE-SIZE 110.
    data : year_month(6) type c.
    data : from_date like sy-datum,to_date like sy-datum.
    INITIALIZATION.
    year_month = sy-datum+0(6).
    CONCATENATE year_month '01' into from_date.
    to_date = sy-datum.
    ranges : temp for mkpf-budat.
    temp-low = from_date.
    temp-high = to_date.
    append temp to temp.
    DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
           jobname like TBTCJOB-JOBNAME,
           L_RELEASE(1) TYPE c.
    CONSTANTS : l_c_device(4)    VALUE 'LOCL'.
    DATA : t type i value 0.
    DATA : p_email1 like somlreci1-receiver,
            p_sender LIKE somlreci1-receiver.
    Data Declaration
    DATA: gd_recsize TYPE i,gd_recsize1 TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject  LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att1 LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att2 LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_desc1 TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des,
          gd_mtitle LIKE sodocchgi1-obj_descr.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    DATA: BEGIN OF mailstr OCCURS 0,
            p_email like somlreci1-receiver,
          END OF mailstr.
    DATA: mailtab like STANDARD TABLE OF mailstr WITH HEADER LINE.
    DATA: ypp18tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ymis008tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ysd15tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ymis10tab like STANDARD TABLE OF mailstr WITH HEADER LINE.
    SUBMIT YSDPASALE1 with bdt in temp
                           to sap-spool
                          with line-size = '255'
                           with KEEP_IN_SPOOL = 'X'
                           with IMMEDIATELY = ' '
                           WITHOUT SPOOL DYNPRO
                           AND RETURN
       NEW-PAGE PRINT ON
       DESTINATION l_c_device
       IMMEDIATELY ' '
       KEEP IN SPOOL 'X'
       NEW LIST IDENTIFICATION 'X'
       NO DIALOG.
       new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
        PERFORM convert_spool_to_pdf.
        select yemail as p_email into CORRESPONDING FIELDS OF TABLE ymis008tab
          from ymail
          where ytcode = 'YMIS008'.
    ELSE.
       SKIP.
       WRITE:/ 'Program must be executed in background in-order for spool & mail sending',
               'request to be created.'.
      ENDIF.
    wait up to 3 seconds.
      submit YSD_MONTHLY_SALES
                                USING SELECTION-SET 'MAIL'
                                to sap-spool
                               with KEEP_IN_SPOOL = 'X'
                               with IMMEDIATELY = ' ' "SPACE
                               WITHOUT SPOOL DYNPRO
                               AND RETURN
       NEW-PAGE PRINT ON
       DESTINATION l_c_device
       IMMEDIATELY ' '
       KEEP IN SPOOL 'X'
       NEW LIST IDENTIFICATION 'X'
       NO DIALOG.
       new-page print off.
        IF sy-batch EQ 'X'.
        gd_attachment_desc1  = 'YMIS10'.
        gd_mtitle = 'Monthly Sales Report'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
        PERFORM convert_spool_to_pdf1.
       loop at it_mess_att.
        move it_mess_att1 to it_mess_att.
        APPEND it_mess_att.
       endloop.
       APPEND LINES OF it_mess_att1 to it_mess_att.
       free it_mess_att1.
        it_mess_att[] = it_mess_att1[].
        insert LINES OF it_mess_att1 into it_mess_att.
        APPEND LINES OF it_mess_att2 to it_mess_att .
         insert LINES OF it_mess_att1 into it_mess_att.
         insert LINES OF it_mess_att2 into it_mess_att.
       loop at ymis008tab into mailstr.
         p_email1 = mailstr-p_email.
          p_email1 = '[email protected]'.
           PERFORM process_email.
       endloop.
           clear mailstr.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
      ELSE.
        SKIP.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
    FORM convert_spool_to_pdf1.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att1 = gd_buffer.
        APPEND it_mess_att1.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      DESCRIBE TABLE it_mess_att1 LINES gd_recsize1.
      CHECK gd_recsize > 0 or gd_recsize1 > 0.
      PERFORM send_email." USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email." USING p_email.
    CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = gd_attachment_desc1 .
    gd_attachment_desc = 'YPP18 - Daily Highlights'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Dear Sir,'.
      APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
      it_mess_bod        = ' '.
      APPEND it_mess_bod.
      it_mess_bod        = 'kindly find the attached document'.
      APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
    it_mess_bod        = 'Do not reply on this mail, It is generated from SAP'.
    APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
      it_mess_bod        = ' '.
      APPEND it_mess_bod.
      it_mess_bod        = 'Regards,'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Arpit Shah'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                          it_mess_att1
                                    using "p_email
                                          gd_mtitle
                                         'Testing mail generated from SAP'
                                         'Daily Highlights Abstract Report - YPP18'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                              it_attach1
                                        using "p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1,w_doc_data1 like sodocchgi1.
    ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data1-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    For 2nd Attachments
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach1 INDEX w_cnt.
      w_doc_data-doc_size = w_doc_data1-doc_size +
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach1 ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
    APPEND LINES OF it_attach1 to t_attachment.
      t_attachment[] = it_attach1[].
    APPEND LINES OF it_attach1 to t_attachment.
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 0.
      t_packing_list-body_start = 1.
    DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
    DESCRIBE TABLE it_mess_att LINES t_packing_list-body_num.
      DESCRIBE TABLE it_attach LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  'YMIS008'."ld_attdescription.
      t_packing_list-obj_name   =  'YMIS008'."ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
      clear t_packing_list.
    for 2 attachments
      data : a type i,b type i.
       a = t_packing_list-body_num.
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 0.
      t_packing_list-body_start = a + 1. "1
    DESCRIBE TABLE it_mess_att1 LINES t_packing_list-body_num.
      DESCRIBE TABLE it_attach1 LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  'YMIS10'."ld_attdescription.
      t_packing_list-obj_name   =  'YMIS10'."ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    a = t_packing_list-body_num.
    clear t_packing_list.
    * Create attachment notification
    t_packing_list-transf_bin = 'X'.
    t_packing_list-head_start = 1.
    t_packing_list-head_num   = 1.
    t_packing_list-body_start = a + 1.
    t_packing_list-body_num = t_packing_list-body_num + 1.
    DESCRIBE TABLE it_mess_att1 LINES t_packing_list-body_num.
    t_packing_list-body_num = a + t_packing_list-body_num .
    t_packing_list-doc_type   =  ld_format.
    t_packing_list-obj_descr  =  'YMIS10'."ld_attdescription.
    t_packing_list-obj_name   =  'YMIS10'."ld_attfilename.
    t_packing_list-doc_size   =  t_packing_list-body_num * 255.
    APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
    loop at ymis008tab into mailstr.
      t_receivers-receiver = mailstr-p_email.  "ld_email.
      t_receivers-receiver = p_email1.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'. "X   "Read Acknoledgement
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
    endloop.
       CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Rgds.
    Arpit

    Hi Arpit,
    Take a look at the documentation of FM 'SO_DOCUMENT_SEND_API1' for parameter PACKING_LIST. I think you should set t_packing_list-head_num to a different value than 0 for the second attachment.
    Regards,
    John.

  • Issue with multiple attachments in email program

    Hi All,
    i need one program which sends 3 excel sheets as an atatchments. in these attachments data should be separated by tab. i am not able to find suitable program for the requirement anybody can send me the code .
    thanks,
    maheedhar

    hi,
    Refer to this link...
    send mail with multiple excel attachments
    Cancatenate  fields of internal table CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB  to get the tab position between the fields.

  • Auto-delete mails with ZIP attachments?

    Unfortunately, I have to do business with Windows users whose machines seem to be infested with viruses that harvest email addresses. As a result, I am engulfed daily with mail that contains Windows virus attachments (ZIP files) and spam with GIF attachments. And I'm tired of it. Reporting the senders to their ISPs is an exercise in futility.
    Since the only legitimate attachments I receive from clients are always, and without exception, Stuffit SIT or SITX files, is there any way to set up a rule in Mail that will delete emails with ZIP or GIF attachments but allow those with SIT/SITX files through?
    There doesn't seem to be a way to add "Attachment" to the list of headers in Rules. In view of the fact that the most common vector for viruses is via email attachments, this seems to be a major oversight on Apple's part.
    Any hints on dealing with this?
    Kind regards.

    Dave,
    sorry for being late but I just saw your message now...
    In 10.3.x, there indeed is no way to filter based on attachment names (this is a new feature present in 10.4.x). However, you should be able to mark all those messages as spam and filter them to your junk mailbox using Junk Matcher:
    http://junkmatcher.sourceforge.net/
    Andreas

  • Rule to delete all mail with ZIP attachments?

    Unfortunately, I have to do business with Windows users whose machines seem to be infested with viruses that harvest email addresses. As a result, I am engulfed daily with mail that contains Windows virus attachments (ZIP files) and spam with GIF attachments. And I'm tired of it. Reporting the senders to their ISPs is an exercise in futility.
    Since the only legitimate attachments I receive from clients are always, and without exception, Stuffit SIT or SITX files, is there any way to set up a rule in Mail that will delete emails with ZIP or GIF attachments but allow those with SIT/SITX files through?
    There doesn't seem to be a way to add "Attachment" to the list of headers in Rules. In view of the fact that the most common vector for viruses is via email attachments, this seems to be a major oversight on Apple's part.
    Any hints on dealing with this ****?
    Kind regards.
    Message was edited by: Dave Bourke. I'm sorry, when did the common word for Hades become forbidden? John Milton is on the banned list now? What is happening to the world?

    Many thanks for your very helpful response, Mikkel.
    However, when I expand the headers on any mail that contains an attachment, there is no header named "Attachment," just a paperclip symbol with an expand arrow.
    So if I go to create a Rule, first of all there is no "Attachment" header in the Conditions list, and second it is unclear how to enter such a symbol-based header in the "Edit Header List..." dialog. Do I simply type the word "Attachment" into the dialog as a header even though it never actually appears in any emails with attachments?
    Still mystified...
    Kind regards.

  • Mail with multiple gmail accounts sending messages from wrong email, other than the one i select

    mail with multiple gmail accounts sending messages from wrong email, other than the one i select:
    i'm using mail on osx 10.7 with multiple gmail accounts. when i create an email, i check to be sure i'm sending/replying from the correct account. after i send it, somehow it actually sends it from a different account, other than the one i've selected "from." this is evidenced by the reply email i receive. how can i fix this?
    in preferences, i have "send new messages from : account of selected mailbox"

    From the Mail menu bar, select
              Mail ▹ Preferences...
    The Mail preference dialog opens. Select the Composing tab from the row of icons at the top. From the menu labeled
              Send new messages from:
    choose
              Account of selected mailbox
    Note that this setting may have no effect if you start a new message while a VIP or smart mailbox is selected in the mailbox list. Those are saved searches, not actual mailboxes.
    If the problem remains, select the Accounts tab in the preference dialog, then select the affected account in the list on the left.
    In the Account Information pane, select the correct server in the menu labeled
              Outgoing Mail Server (SMTP)
    If there's only one server in the menu, select
              Edit SMTP Server List...
    and add a new server with the correct settings. If you're not sure how to do that, try the Mail Settings Lookup.
    Another possibility is that the wrong card in your address book is selected as yours. Select your card in the Contacts application. Then select
              Card ▹ Make This My Card
    from the menu bar.

  • Send Mail with Multiple Attachment

    How to send mail with multiple attachment. The documents are in a table column BLOB. Read and attach in to mail directly.
    We don’t want save the documents into hard disk and attach to mail. Please Help
    If you have java procedure or Pl/Sql Procedure. I think pl/sql can’t. So please mail me code to [email protected] mail id. Thank you.
    Thanks in advance
    Selvam

    Hi all
    Thanks for your reply, already tried this methods, Its not working for my requirements. Because my attachment is can be any type like ‘pdf’,’doc’,’txt’,’xls’,’jpg’,….
    And also the Utl_mail is very slow. Its using RAW type.
    I can use the javamail package to solve this problem, this javamail package needs to download into server from there you can attach thus documents into mail. But I want fetch the documents and ate the same time I want attach to a mail. Like yahoo attach or msn attachment.
    Thank you,
    Selvam

  • File to RFC with multiple records using BPM Scenario Error...!!!

    Hello Guru's,
      I have done the File to RFC with multiple records using BPM scenario as per the Materiel available in the sdn.sap. This involves BAPI (BAPI_MATERIEL_AVAILABILITY). I have done exactly the same what is their in the materiel. SXI_CACHE is also giving return value " 0 ". File is getting deleted from the source directory, but no file in target directory. SXMB_MONI is also showing no error (black Flag). BPM is also error free. Checked the interfaces also.
    Can any one tell me what mistake would i have done.
    Thanks in advance.

    Hi,
    There is one similar discussion I found,
    FTP TO RFC using BPM
    Thanks
    Swarup

Maybe you are looking for

  • HT2905 Where has Display Duplicates gone in iTunes 11

    There is no Display Duplicates in iTunes 11 - if I had known I would not have updated this is essential when adding CD's to the library - and I can find no way to contact apple as I have to have a product with a serial number to ask them a question a

  • Time varying velocity input for servo motor

    I 'm running a PXI-8145RT CPU with a 7344 motion controller.I want to load a time varying velocity profile for my servo motor.How can I do this? The "load velocity" tile does not have an input for such a profile,but only for a maximum velocity that w

  • New CS2 Premium spanish--switch to English?

    I have a older CS2 Premium new in the box...spanish version. Is there anyway to 'switch' it to English as it installs? Or how would I upgrade to an English version? Thanks....

  • Get error, iTunes has stopped working when sync iPad

    when sync iPad in step 2  Get error, iTunes has stopped working

  • Script remove archives from standby after applied

    Hello, I am looking for a script to remove archivelog files from the standby flash recovery area after beeing applied. My database is 11.2.0.3.3 on Linux Redhat 5. Can someone kindly proovide me an example? Thank you