Add file attachment

I develop a jsp page to send an email message. How can I can attatch a file with a message?
Ideas appreciate
Pierre
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<html>
<head>
<title>Send an email with jsp page</title>
</head>
<body bgcolor="#C0C0C0" text="#CC0000" >
<%
if(request.getMethod().equals("POST") )
boolean status = true;
// enter here the smtp mail server address
// ask your ISP to get the proper name
String mailServer = "xxx.xxx.com";
String fromEmail = request.getParameter("from");
String toEmail = request.getParameter("to");
String messageEnter = request.getParameter("message");
if(toEmail.equals("") )
toEmail = "unknow";
try
Properties props = new Properties();
props.put("mail.smtp.host", mailServer);
Session s = Session.getInstance(props,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress(fromEmail);
message.setFrom(from);
InternetAddress to = new InternetAddress(toEmail);
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject("Send Email with jsp");
message.setText(messageEnter);
Transport.send(message);
catch(NullPointerException n)
System.out.println(n.getMessage() );
out.println("ERROR, you need to enter a message");
status = false;
catch (Exception e)
System.out.println(e.getMessage() );
out.println("ERROR, your message to " + toEmail + " failed, reason is: " + e);
status = false;
if (status == true)
out.println("Your message to " + toEmail + " was sent successfully!");
else
%>
<h1>Send Email with jsp</h1>
<form method="post" name="mail" action="mail.jsp">
<table BORDER="0">
<tr>
<td>To :</td>
<td><input type="text" name="to" size=24></td>
</tr>
<p>
<tr>
<td>From :</td>
<td><input type="text" name="from" size=24></td>
</tr>
<p>
<tr>
<td>Message :</td>
<td><TEXTAREA name="message" ROWS = "5" COLS="65"></TEXTAREA></td>
</tr>
</table>
<p>
<font face="Helvetica"><input type="submit"
value="Submit" name="Command">
</font>
</form>
<%
%>
</body>
</html>

Thanks for the reference.
This new code could do the job?
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
// Fill the message
messageBodyPart.setText("Pardon Ideas");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send(message);
I also need to add these lines
to the jsp page ?
<FORM ENCTYPE="multipart/form-data"
method=post action="/myservlet"> <INPUT TYPE="file" NAME="thefile">
<INPUT TYPE="submit" VALUE="Upload">
</FORM>

Similar Messages

  • [CRM 5.0] How to add file attachements to created ticket (transaction)

    Hi!
    I have to do engancement and need to add file attachements to tickets (transaction) documents. I made ticket creation but I don't know how to add file attachements to it.
    Could someone help? Mayby some function module name?
    Thanks for response!
    KK

    class cl_crm_documents has a number of methods which should be of use to you.
    create_with_table will allow the file to be created from data held in a table and attached to the activity.
    create_with_File will allow you to create with reference to an existing file.
    here is an example of the use of create_with_table.
    form create_document  using    p_bus_obj type sibflporb
                                   p_properties type sdokproptys
                                   p_file_access type sdokfilacis
                                   p_file_contents type sdokcntbins
                          changing p_error type skwf_error.
      call method cl_crm_documents=>create_with_table
       exporting
          business_object     = p_bus_obj
          properties          = p_properties
    *                properties_attr     =
                 file_access_info    = p_file_access
    *                file_content_ascii  =
          file_content_binary = p_file_contents
    *                raw_mode            =
    *                text_as_stream      =
    *                parent_folder       =
    *                package_id          =
        importing
    *                loio                =
    *                phio                =
          error               = p_error.
    endform.                    " CREATE_DOCUMENT
    p_bus_obj-typeid needs to be set with guid of transaction
    p_bus_obj-catid = 'BO'.

  • Add File Attachment to CI using Powershell

    Hi Everyone,
    does sombody have a sample Powershell script of how to add an file attachment to a CI ? Found a few c# samples, but need to use Powershell.
    I want to add Icon files to a CI as File attatchment.
    Thanks

    Hi Sebastian,
    Try this:
    # --- load smlets ---
    $a = (get-module|%{$_.name}) -join " "
    if(!$a.Contains("SMLets")){Import-Module SMLets -ErrorVariable err -Force}
    $managementGroup = new-object Microsoft.EnterpriseManagement.EnterpriseManagementGroup "localhost"
    $FileAttachmentRel = Get-SCSMRelationshipClass "System.ConfigItemHasFileAttachment"
    $classFA = Get-SCSMClass -name "System.FileAttachment"
    $Folder = "C:\temp\temp2"
    $File = get-childitem $folder | ?{$_.name -like 'test.txt'}
    $CItp = Get-SCSMObjectProjection System.ConfigItem.Projection -filter "DisplayName -eq 'Win7'"
    $filepath = $Folder +"\" + $File.Name
    #------------ Inject attach --------------------------------------------------------------------
    $mode =[System.IO.FileMode]::Open
    $fRead = new-object System.IO.FileStream $filepath, $mode
    $length = $file.length
    $newFileAttach = new-object Microsoft.EnterpriseManagement.Common.CreatableEnterpriseManagementObject($managementGroup, $classFA)
    $newFileAttach.Item($classFA, "Id").Value = [Guid]::NewGuid().ToString()
    $newFileAttach.Item($classFA, "DisplayName").Value = $File.Name
    $newFileAttach.Item($classFA, "Description").Value = $File.Name
    $newFileAttach.Item($classFA, "Extension").Value = $File.Extension
    $newFileAttach.Item($classFA, "Size").Value = $length
    $newFileAttach.Item($classFA, "AddedDate").Value = [DateTime]::Now.ToUniversalTime()
    $newFileAttach.Item($classFA, "Content").Value = $fRead
    $CItp.__base.Add($newFileAttach, $FileAttachmentRel.Target)
    $CItp.__base.Commit()
    $fRead.close()
    Cheers,
    Marat
    Site: www.scutils.com  Twitter:
      LinkedIn:
      Facebook:

  • How can I add file attachment to my form and get the attachment by email?

    I'm using this code and it works fine, but I don't get the attachment file in the email. How can I add this to my code?
    HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
    <script src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript">// <![CDATA[
                  $(document).ready(function() {
                    $("#form1").validate({
                      rules: {
                        first: "required",// simple rule, converted to {required:true}
                        email: {// compound rule
                        required: true,
                        email: true
                      last: {
                        last: true
                      comment: {
                        required: true
                      messages: {
                        comment: "Please enter a comment."
    // ]]></script>
    <script type="text/javascript">// <![CDATA[
    function validate ()
              if (document.form1.first.value == "")
              alert("Please enter your First Name");
              document.form1.first.focus();
              document.form1.first.style.border="1px solid red";
              return false;
              else if (document.form1.last.value == "")
              alert("Please enter your Last Name");
              document.form1.last.focus();
              document.form1.last.style.border="1px solid red";
              return false;
              else if (document.form1.emailaddress.value == "")
              alert("Please enter your Email Address");
              document.form1.emailaddress.focus();
              document.form1.emailaddress.style.border="1px solid red";
              return false;
    function has_focus() {
        if(document.form1.first.value == "")
                                  document.form1.first.focus();
                                  document.form1.style.first.border="1px solid green";
    function set_focus(x)
              document.getElementById(x).style.border="1px solid #80CA75";
    function clear_focus(x)
              document.getElementById(x).style.border="1px solid #DBDFE6";
    // ]]></script>
    </head>
    <body>
    <p><span style="color: #666666; text-align: center; font-size: 13px;">Please complete this form if you have any technical issue.</span></p>
    <form id="form1" action="http://www.southsun.com/php/tech_issue.php" enctype="multipart/form-data" method="post">
    <table style="width: 850px; font-size: 15px; padding-left: 20px; text-align: center;" border="0">
    <tbody>
    <tr>
    <td style="text-align: left; padding-bottom: 20px;" colspan="2">
    <h2><span style="color: #666666;">Please complete this form if you have any technical issue.</span></h2>
    </td>
    </tr>
    <tr style="padding-top: 40px;">
    <td style="text-align: left;"><span style="color: #abaf6f;"><strong>First Name</strong>:*</span><input id="first1" name="first" type="text" />  <br /><br /> <span style="color: #abaf6f;"><strong>Last Name</strong>:*</span><input id="last1" name="last" type="text" /><br /><br /> <span style="color: #abaf6f; padding-right: 33px;"><strong>Email</strong>:</span><span style="color: #abaf6f;">*</span><input id="email1" name="email" type="text" /><br /><br /> <span style="color: #abaf6f;"><strong>Shipping Method:</strong><br /></span> <input name="shippingmethod" type="radio" value="prioritymail" /> Priority Mail                                                                 <input name="shippingmethod" type="radio" value="store" /> In Store Pick up <br /> <input name="shippingmethod" type="radio" value="ground" />  Ground                                                                       <input name="shippingmethod" type="radio" value="3day" /> 3 Day Select<br /><br /> <span style="color: #abaf6f;"><strong>Payment Method:</strong><br /></span> <input name="paymentmethod" type="radio" value="paypal" /> Paypal Method                                                       <input name="paymentmethod" type="radio" value="creditcard" /> Credit Card<br /> <strong><br /> <span style="color: #abaf6f;">If getting an error message, please explain the error:</span></strong><span style="color: #abaf6f;"> <br /></span> <textarea id="errormessage" cols="20" rows="2" name="errormessage"></textarea><br /><br /></td>
    <td style="border-left: 1px solid grey; padding-left: 40px; text-align: left;"><span style="color: #abaf6f;"><strong>If using Paypal, Were you redirected successfully?</strong><br /></span> <input name="paypalredirect" type="radio" value="yes" /> Yes                                                                 <input name="paypalredirect" type="radio" value="no" /> No<br /><br /> <span style="color: #abaf6f;"><strong>If using Credit Card, Did you get an error?</strong><br /></span> <input name="carderror" type="radio" value="yes" /> Yes                                                                  <input name="carderror" type="radio" value="no" /> No<br /><br /> <span style="color: #abaf6f;"><strong>What happened after clicking place order? </strong><br /></span> <textarea id="placeorder1" cols="20" rows="2" name="placeorder"></textarea><br /><br /> <span style="color: #abaf6f;"><strong>Comments</strong>: <br /></span> <textarea id="comments1" cols="20" rows="2" name="strcomments"></textarea><br /><br /> <span style="color: #abaf6f;"><strong>Attach PrintScreen</strong>: <br /></span> <input name="strresume" type="file" />
    <div style="height: 50px;"> </div>
    </td>
    </tr>
    <tr>
    <td style="padding-top: 20px;" colspan="2">( * ) indicates required fields</td>
    </tr>
    <tr>
    <td style="text-align: center; padding-top: 20px;" colspan="2"><input class="button" name="submit" type="submit" value="Submit" />                        <input class="button" name="reset" type="reset" value="Reset" /></td>
    </tr>
    </tbody>
    </table>
    </form>
    </body></html>
    PHP
    <?php
    echo $savestring;
    //--------------------------paramaters--------------------------
    // Subject of email sent to you.
    $subject = 'prueba con uploads';
    // Your email address. This is where the form information will be sent.
    $emailadd = '[email protected]';
    // Where to redirect after form is processed.
    $url = 'http://www.pch-graphicdesign.com';
    // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
    $req = '0';
    $target_path = "http://www.pch-graphicdesign.com/php/uploads/";
    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
    $text = "Results from form:\n\n";
    $space = ' ';
    $line = '
    foreach ($_POST as $key => $value)
    if ($req == '1')
    if ($value == '')
    {echo "$key is empty";die;}
    $j = strlen($key);
    if ($j >= 20)
    {echo "Name of form element $key cannot be longer than 20 characters";die;}
    $j = 20 - $j;
    for ($i = 1; $i <= $j; $i++)
    {$space .= ' ';}
    $value = str_replace('\n', "$line", $value);
    $conc = "{$key}:$space{$value}$line";
    $text .= $conc;
    $space = ' ';
    mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
    echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    ?>

    Sending a file as an attachment to an email involves setting the correct MIME type and headers. There's a brief tutorial here: http://webcheatsheet.com/php/send_email_text_html_attachment.php.
    Also, you need to use the same name as in your form. In the script you have shown here, the name of the file field is strresume, but your processing script uses this: $_FILES['uploadedfile']['name']. It should be this: $_FILES['strresume']['name']

  • Can not add a new event with attachments, for that is not ... add file attachaments

    file://localhost/Users/bogdan/Desktop/Screen%20Shot%202012-01-28%20at%2008.59.06 .png

    Hi Cmrl,
    Does it happen when you create an appointment via OWA?
    Does it happen when you create an appointment via Outlook 2003?
    Do you have any mobile device?
    How many users encountered the issue, all users or some user?
    At first, I suggest you recreate outlook profile.
    At second, 
    use PFDAVAdmin
    to correct any problems found.

  • How do  I add an attachment (xls file in my case) to the pdf

    Hello,
    I need to add a excel file as attachment in the generated PDF form.
    Someone could tell me if this is possible and how to do it?
    Thanks for the help

    Hi,
    I did little research and found that we can attach any attachment to Interactive form.
    1.Get the XLS attachment(You can add File Upload UI Element(Say XLS) to your Application  and Bind  data,filename and mime Type  Properties)   with this , user can choose the XLS file to be attached from Desk top.
    2. In the Interactive UI Element,bind the property "pdfsource" (Say PDF_SOURCE), this will  contains the PDF in xstring format.
    3. Add a button (Say Attach XLS) on the application and add an Action Method.(Say ADD)
    4.in the Action Method(ADD) of the Button, follow the Steps.
        1. Get the File(XLS File) Uploaded,Mimi Type  from File Uploade UI Element(Say lv_xls_data,lv_mimetype,lv_file_name)
         2. get the pdf source( PDF_SOURCE) from Interactive form.(Say lv_pdf_source)
         use the Following Code
    DATA: l_fp           TYPE REF TO if_fp,
            l_pdfobj       TYPE REF TO if_fp_pdf_object,
            l_pdf          TYPE xstring,
            l_att          TYPE xstring,
            l_fpex         TYPE REF TO cx_fp_runtime,
            l_type         TYPE string,
            l_errmsg       TYPE string,
            l_short        TYPE sdba_actid,
            l_ext          TYPE sdba_funct,
            l_filename     TYPE skwf_filnm,
            l_mimetype     TYPE skwf_mime,
            l_attachment   TYPE sfpattachments,
            l_attachments  TYPE tfpattachments,
            l_len          TYPE i,
            l_tab          TYPE tsfixml,
            p_dest         TYPE rfcdest .
      MOVE cl_fp=>get_ads_connection( ) TO p_dest.
      l_mimetype   = lv_mimetype.
    * Get FP reference.
      l_fp = cl_fp=>get_reference( ).
      TRY.
    *     Create PDF Object.
          l_pdfobj = l_fp->create_pdf_object( connection = p_dest ).
    *     Set document.
          l_pdfobj->set_document( pdfdata = lv_pdf_source ).
           l_attachment-FILENAME = lv_file_name."Name of the Attached File.
          l_attachment-mimetype    = lv_mimetype.
          l_attachment-description = 'XLS_Attachment'.   
         l_attachment-data        = lv_xls_data."XLS File to Be attached .
          INSERT l_attachment INTO TABLE l_attachments.
          l_pdfobj->set_attachments( attachments = l_attachments ).
    *     Execute, call ADS.
          l_pdfobj->execute( ).
    *     Get result.
          l_pdfobj->get_document( IMPORTING pdfdata = l_pdf ).
        CATCH cx_fp_runtime_internal INTO l_fpex.           "#EC NO_HANDLER
        CATCH cx_fp_runtime_system INTO l_fpex.             "#EC NO_HANDLER
        CATCH cx_fp_runtime_usage INTO l_fpex.              "#EC NO_HANDLER
      ENDTRY.
    Finally "l_pdf" contains the PDF with Attached XLS and you can send this as PDF Document.
    Thanks.
    Uma

  • Need help creating an "insert file" to add an attachment to a form?  Is this possible?

    I am trying to add an "insert file/attachment" field to a form that I'm creating but am having trouble finding information.   Is this possible?   Please advise.
    Thank you!

    Hi,
    The form with add attachment feature on link http://eslifeline.files.wordpress.com/2009/04/addattachments.pdf
    works fine but when I copy paste objects to use 2-3 times on page 2 and 3 then after attaching different files at all 3 sections, I see only same type of files when using view attachments. I understand it is same like when making 2 fields name same act same together.
    Please help me make the javascript run differently (as new) for each add attachment function.
    Thanks

  • When trying to add an attachment for my online class i cannot seem to see any of my computers files or documents

    I am attending an online class through QCC Online. When I try to "add an attachment" from my files to submit an assignment, it will not let me see (or attach) any of my computers files or documents.

    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!

  • Is there any way to automatically add an attachment to a message in Mail?

    Hi,
    I have to responsd to a lot of emails with basically the same response. I use a TextExpander snippet for the body of these messages. However, I usually need to attach a PDF file as well.
    Is there anyway to automate attaching a PDF attachement to a message in Mail?
    Perhaps, this can be done by adding the attachment into a Signature, although I havent seen a way to do this.
    Or perhaps, some kind of Automator scritpt?
    The mail account is actually a Google Apps account, so perhaps there is a way to have the GMail server do something to the message on the way out?
    Thanks

    it's fairly easy to create an outgoing message with attachments in applescript; just use a script like the following:
    tell application "Mail"
              set newMess to make new outgoing message with properties {visible:true, subject:"test emal"}
              tell newMess
      make new attachment at end of attachments with properties {file name:"/path/to/attachment"}
              end tell
    end tell
    it's extremely difficult to add an attachment to an outgoing email that's already been created, however (there's no easy way in applescript to get a reference to an open outgoing message window if the script did not make the window itself).  I'm not sure which you had in mind.

  • How can I add a attachment field to my new form list

    I have the setting checked yes for attachments. Then I click on the edit tab above then attach file, once I attach the file, it disappears and I cant see it after the record is saved. So how would I add a attachment to a record?

    Hi Soupi,
    From your description, my understanding is that you want to show attachments in list view.
    By default, the list view only contain the Title column. If you want to show whether there is an attechment in an item, you can modify the view and show the Attachments column as Clicking List->Modify View, check "Attachments" in Columns section.
    After the above, the result is like:
    In the above image, test1 has an attachment, test1 doesn't have attachments.
    Thanks,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Is it possible to add files to a PDF form submission?

    Hi there,
    Someone asked me to add an attachment field to a PDF dynamic form. Based on previous research we figured out that will not be possible: our users don't have Acrobat - just Reader - and we won't purchase Reader Extensions. How about using a form field to help the user send the attachments that a are required with that give form? For instance:
    - User would fill in the form and when asked for attachments he/she would browse for the file.
    - The form would save the file name as text on the form (like the answer for a text field)
    - The PDF form would memorize the location of the file(s)
    - When the user hits "Submit" the PDF form would gather the files listed for attachment and add them as attachments - in additon to itself - to the email created by the submission button.
    That way the attachments are not saved as part of the PDF form, but the PDF form is automating the process of adding them to the submission email.
    Is that doable with LiveCycle Designer? Any tips on how to go about coding/building those actions?
    Thanks in advance,
    AV

    If your user is using Adobe Reader and wants to add an attachment to your PDF file... you need Adobe LiveCycle Designer Reader Extensions to do that...
    If your user is using Adobe Acrobat Pro then u can add attachments with this
    var myDoc = event.target;
    var sFile = "myFile" + NumericField1.rawValue;
    myDoc.importDataObject({cName: sFile});
    var myDataObject = myDoc.getDataObject(sFile); 
    var sFileName = myDataObject.path; 
    ListBox1.addItem(sFileName,sFile); 
    NumericField1.rawValue = NumericField1.rawValue + 1;
    you can also remove the file
    myDoc.removeDataObject(sFile);
    you can also open the file
    myDoc.exportDataObject({ cName: sFile, nLaunch: 2 });

  • Get file attachment list

    I need a script that on file open will get the names of all attachments and add them to a listbox.

    Hi,
    Perform the following steps to create a multi-file attachment in InfoPath:
    Add a Repeating Table with 1 column to your InfoPath form template.
    Go to the Data Source task pane and double-click the field under the repeating node for the Repeating Table.
    Change the Data type to Picture or File Attachment (base 64) and click OK.
    Right-click the field in the Repeating Table on the InfoPath form template, and select Change To, and then File Attachment from the context menu that appears.
    Ref: http://www.bizsupportonline.net/blog/2010/04/top-10-questions-infopath-file-attachments/
    Thanks,
    Avni Bhatt
    If this helped you resolve your issue, please mark it Answered

  • How to add files in a pdf file

    Hello friends,
    This is Siddhartha from India, I want a favour from you, can anyone please tell me how to add files into pdf file, as an attachment ?
    Looking forward for your timely response,
    Thanks & Regards
    Siddhartha

    Dear Bill@VT,
    Thanks for your timely response, by attachment I meant any file that can be added as an attachment, it could be any file, it does not mean to insert pages, it means the same as when you attach a file in your email, while sending the mail to some one, now the thing is that I want the same functionality in Adobe Reader, so do u have any idea, for the same......
    Looking forward for your response
    Regards
    Siddhartha

  • File Attachements

    I have a problem with file attachements.
    Ther are two types of attachements, FileAttachements as annotations, or attachements as DataObjects, I tried.
    I have to solve this problem:
    Using JS, I have to import a FileAttachement into the my document, and the user has to open it, both in Acrobat pro AND in Reader (with form support).
    (all cause of accessibility, using just a button).
    In Acro pro I can use DataObjects to import an open, but, in Reader I can only open an attachement, but not add it.
    Coul I therfore use FileAttachement as an annotation?
    I tried this code, but there was no result in adding the the file.
    >var annot = this.addAnnot({
    page: 0,
    type: "FileAttachment",
    contents: "File description",
    author: "A. C. Robat",
    name: "C/temp/Testseite.pdf",
    path: "C/temp/Testseite.pdf",
    rect: [540, 540]
    The symbol has been placed correctly, and in the annotation window, there are informations like author, description ...
    But no File has been attached.
    What is wrong?
    And how could I open the attached file of an annotation?
    I did not find any description...
    Could anyone help?

    At this time playing WAV files from attachments is not possible. You may want to Submit feedback on this and put in a request for it to be a added feature.
    http://www.apple.com/feedback/iphone.html
    Customers feedback influences changes the most.

  • To Send HTML Format and excel file attachment  in same mail

    Dear All,
            Have requerment ,to send a mail options HTML table format and same data in excel file attachement.have capable to do the html format using methods BCS .but how to send excel format attachment in same  mail.
    Please guide me how to do it.
    Regards ,
    Santhu
    Edited by: santosh jajur on Apr 9, 2010 1:54 PM

    Santhosh,
    please check the code:
    report bcs_example_7.
    This report provides an example for sending an Excel
    attachment in Unicode Systems
    constants:
      gc_tab  type c value cl_bcs_convert=>gc_tab,
      gc_crlf type c value cl_bcs_convert=>gc_crlf.
    parameters:
      mailto type ad_smtpadr
       default 'ur mail id'.                    "#EC *
    data send_request   type ref to cl_bcs.
    data document       type ref to cl_document_bcs.
    data recipient      type ref to if_recipient_bcs.
    data bcs_exception  type ref to cx_bcs.
    data main_text      type bcsy_text.
    data binary_content type solix_tab.
    data size           type so_obj_len.
    data sent_to_all    type os_boolean.
    start-of-selection.
      perform create_content.
      perform send.
    form send.
      try.
          send_request = cl_bcs=>create_persistent( ).
        create document object from internal table with text
          append 'Hello world!' to main_text.                   "#EC NOTEXT
          document = cl_document_bcs=>create_document(
            i_type    = 'RAW'
            i_text    = main_text
            i_subject = 'Test Created By BCS_EXAMPLE_7' ).      "#EC NOTEXT
        add the spread sheet as attachment to document object
          document->add_attachment(
            i_attachment_type    = 'xls'                        "#EC NOTEXT
            i_attachment_subject = 'ExampleSpreadSheet'         "#EC NOTEXT
            i_attachment_size    = size
            i_att_content_hex    = binary_content ).
        add document object to send request
          send_request->set_document( document ).
        --------- add recipient (e-mail address) -----------------------
        create recipient object
          recipient = cl_cam_address_bcs=>create_internet_address( mailto ).
        add recipient object to send request
          send_request->add_recipient( recipient ).
        ---------- send document ---------------------------------------
          sent_to_all = send_request->send( i_with_error_screen = 'X' ).
          commit work.
          if sent_to_all is initial.
            message i500(sbcoms) with mailto.
          else.
            message s022(so).
          endif.
      endtry.
    endform.                    "send
    form create_content.
      data lv_string type string.
      data ls_t100 type t100.
    columns are separated by TAB and each line ends with CRLF
      concatenate 'This Is Just Example Text!'                  "#EC NOTEXT
                  gc_crlf gc_crlf
                  into lv_string.
    header line
      concatenate lv_string
                  'MSGID'    gc_tab
                  'MSGNO'    gc_tab
                  'Language' gc_tab                             "#EC NOTEXT
                  'Text'     gc_crlf                            "#EC NOTEXT
                  into lv_string.
    data lines
      select * from t100 into ls_t100
        where arbgb = 'SO' and msgnr = '182'.
        concatenate lv_string
                    ls_t100-arbgb gc_tab
                    ls_t100-msgnr gc_tab
                    ls_t100-sprsl gc_tab
                    ls_t100-text  gc_crlf
                    into lv_string.
      endselect.
      select * from t100 into ls_t100
        where arbgb = 'SO' and msgnr = '316'.
        concatenate lv_string
                    ls_t100-arbgb gc_tab
                    ls_t100-msgnr gc_tab
                    ls_t100-sprsl gc_tab
                    ls_t100-text  gc_crlf
                    into lv_string.
      endselect.
      try.
          cl_bcs_convert=>string_to_solix(
            exporting
              iv_string   = lv_string
              iv_codepage = '4103'  "suitable for MS Excel, leave empty
              iv_add_bom  = 'X'     "for other doc types
            importing
              et_solix  = binary_content
              ev_size   = size ).
        catch cx_bcs.
          message e445(so).
      endtry.
    endform.                    "create_content
    Thanks.

Maybe you are looking for

  • HT201210 my ipod touch is in recovery mode and wont restore?

    my ipod touch 3rd generation 8gb is in recovery mode. it has been charging but nothing has happened and i am unable to turn it on.i connected it to itunes and was told it needs to be restored. i tried this but it said that the software for this is cu

  • My MacBook and my Monitor won't work together anymore

    Ok i have a macbook i got less than a year ago and for the last 2 months i have been running my old samsung monitor off of a mac mini port to VGA and now it won't work anymore when ever i connect it the monitors light just flashes on and off repeated

  • As a result of very poor customer service, I am a ...

    I decided to come back to BT after a 2-year stint with Virginmedia. I think I've made a huge mistake ! It all started so well, too. I signed up to the Anytime Call Plan and Broadband Option 3, with a discount for the first 3 months. It all started ve

  • E Recruitment how to create Carrier and Job link

    Hi My client asking for carrier and job option in ESS, presently we are implementing to E Recruitment only We donu2019t have EP Consultant, Please any one help me how to create Carrier and Job link (we are using BSP and Webdynp) Regards eshwar

  • Making 3D photos

    I don't think this is the right place to post this, but I couldn't find anywhere else. Is there any Mac software that would allow me to convert a single or pair of photos into and .mpo 3d file and/or anaglyph ? I know how to view 3D photos with ShowM