Send files thru email

hey all
is it possible to send files thru email using a java program??? i tried using Runtime..... and executing outlook...but i could not figure out how to give filename and reciever's name at the command prompt...can anybody help me in this???
thanx in advance
bharthi

This is a good tutorial for javamail:
http://developer.java.sun.com/developer/onlineTraining/JavaMail/
The part about sending attachments is:
http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#SendingAttachments

Similar Messages

  • Sending messages thru email and SMS without using XMS APIs

    Hi,
    I already have some working code that sends messages thru email and SMS. But currently it uses XMS APIs therefore I have a dependency on files like wdk.jar. I want to try and eliminate using the XMS APIs and only use soap to send these messages. I was wondering if there is some documentation available on how I can do this. Also if there a lot of code that needs to be written to do that.
    I primarily want a very simple application that sends only string messages and reduce my dependencies.
    I would really appreciate all the advice.
    Thanks,
    Sonali Nath

    Hi,
    You may refer to the following links to check if they help:
    Sending SCCM Status Messages from MDT Scripts.
    Send SCCM task sequence email report
    Regards,
    Sabrina

  • Sending PDF thru email with password protection in our SAP system

    Need solution for sending PDF thru email with password protection in our SAP ecc 6

    Or maybe you have found any other way? You can check here:
    Password protect PDF file:
    Re: Password protected PDF file 
    pdf with password encryption
    Regards Otto

  • Preview 6.0, no send file as email attachment?

    Does anyone know where they put the send file command?  I need to email pdfs from Preview all the time.
    There used to be a "send file as email attachment" command under the edit menu.  It's gone.  Anyone have any suggestions?

    Handsomfreddy wrote:
    Sorry, I dont understand what you are referring to. Can you calify please "undo the changes."
    Thanks,
    Andy
    Didn't you just post this (below)
    Handsomfreddy wrote:
    Very bizarrely Parallels had changed this Mail Preference to some weird Windows program [Disk Clean up or something equally random] thus preventing me from emailing anything from any program.
    That's the change I am referring to.

  • I can't send files by email

    After update the Adobe I can't send files by email

    Hi,
    Thanks for writing to us . Do you see some error while sending files by email ? Please share the screenshot of error you see.
    Thanks ,
    Shefali

  • Send file by email

    I have a program which will generate a text file. Now, I would like send the file to an external email. How can I do that. Thanks!

    Hi,
    See the below code:
    *& Report  ZATTACH                                               *
    REPORT  ZATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT <youremailaddress>.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    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,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
    *   Retrieve sample data from table ekpo
      PERFORM data_retrieval.
    *   Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    * Populate message body text
      perform populate_email_message_body.
    * Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
    *   Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
    *       Build data table for .xls document
    FORM build_xls_data_table.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
    *    con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    *    con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *       Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        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.
      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_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[] = pit_attach[].
    * 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   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  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.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      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.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
    *       Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
    *        Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.
    " POPULATE_EMAIL_MESSAGE_BODY
    Reward points if this helps,
    Kiran

  • Send file as email attachment not working

    any help would be greatly appreciated...
    When I click "send file as email attachment" it will open outlook with the PDF attached but when I click send on the email,  the email closes like it is sent but never actually gets sent (nothing in sent items and recipient never gets the email)
    Adobe Acrobat 11 Pro (Creative Cloud Suite installed)
    Outlook 2013

    Hi sandyw26405588,
    Could you please try sending PDF as email attachment via another email apart from Outlook.
    Are you able to send the file successfully?
    Also, go under 'Help> Check for Updates' and ensure if you are using the latest version of Acrobat XI i.e. 11.0.10
    Have you tried sending any other PDF via Outlook?
    Let me know.
    Regards,
    Anubha

  • Ipad sending messages thru email

    suddenly my iPad is only sending messages thru my email and not snyc thru my phone number so essentially I don't get text showing on iPad when I go to settings it only shows my email address and no ability to ad a phone number. I'm not sure what changed it. I've reset network and all other settings and turned on and off the iMessage slider

    Or maybe you have found any other way? You can check here:
    Password protect PDF file:
    Re: Password protected PDF file 
    pdf with password encryption
    Regards Otto

  • Problem in sending file thru sockets

    Hello
    i am sending a file thru sockets....the file reaches the server but there is loss of file contents. i do not recieve the entire file. whats wrong?
    my Server code
    //package socket_try ;
    // SimpleServer.java: a simple server program
    import java.net.*;
    import java.io.*;
    import javax.comm.*;
    import java.util.*;
    public class Server
    public static final int BUFFER_SIZE = 1024 * 50;
    static CommPortIdentifier portId;
    static Enumeration portList;
    SerialPort serialPort;
    Thread readThread;
    public static void main(String[] ar)
    byte[] buffer;
    buffer = new byte[BUFFER_SIZE];
    int port = 6666; // just a random port. make sure you enter something between 1025 and 65535.
    boolean portFound;
    try
    ServerSocket ss = new ServerSocket(port); // create a server socket and bind it to the above port number.
    System.out.println("Waiting for a client...");
    Socket socket = ss.accept(); // make the server listen for a connection, and let you know when it gets one.
    System.out.println("Got a client :) ... Finally, someone saw me through all the cover!");
    System.out.println();
    BufferedInputStream bin = new BufferedInputStream(socket.getInputStream());
    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("c:\\SMS.txt"));
    int in;
    try
    int len = 0;
              while ((len = bin.read(buffer)) > 0) {
                   bos.write(buffer, 0, len);
                   System.out.print("#");
              bin.close();
              bos.flush();
              bos.close();
              socket.close();
    ss.close();
    catch(Exception x)
    x.printStackTrace();
    catch(Exception e)
    System.out.println("Exception : "+e);
    my client code
    import java.net.*;
    import java.io.*;
    public class Client
    public static final int BUFFER_SIZE = 1024 * 50;
    public static void main(String[] ar)
    int serverPort = 6666; // make sure you give the port number on which the server is listening.
    String address = "192.168.1.3"; // this is the IP address of the server program's computer. // the address given here means "the same computer
    as the client".
    int in=0;
    byte[] byteArray;
    byte[] buffer;
    buffer = new byte[BUFFER_SIZE];
    try
    InetAddress ipAddress = InetAddress.getByName(address); // create an object that represents the above IP address.
    System.out.println("Any of you heard of a socket with IP address " + address + " and port " + serverPort + "?");
    Socket socket = new Socket(ipAddress, serverPort); // create a socket with the server's IP address and server's port.
    System.out.println("Yes! I just got hold of the program.");
    // Get the input and output streams of the socket, so that you can receive and send data to the client.
    // Just converting them to different streams, so that string handling becomes easier.
    BufferedInputStream bis;
    BufferedOutputStream bos;
    bis = new BufferedInputStream(new FileInputStream("c:\\send.txt"));
    bos = new BufferedOutputStream(socket.getOutputStream());
    byte[] receivedData;
    int len = 0;
    while ((len = bis.read(buffer)) > 0)
    bos.write(buffer, 0, len);
    System.out.print("#");
         for(int y =0 ; y < buffer.length ; y++)
    char s =(char) buffer[y];
    System.out.println("character:"+s);
    bis.close();
    bos.flush();
    bos.close();
    socket.close();
    System.out.println("\nDone!");
    catch(Exception x)
    x.printStackTrace();
    } /* end of main */
    }/* end of class */
    what is wrong can please anyone tell me??????

    As I don't know how long a record is, that's not a very useful answer. How many bytes are you expecting and how many do you actually get?

  • Send File as Email

    In earlier versions of Acrobat Reader there was a handy mail button that I could use to email the document open at that particular time.  With the current version, that button does not appear to be there.  Is there some other way of sending a file by email from within Acrobat?

    Please try the steps mentioned at: http://support.microsoft.com/kb/813745 and check whether the issue is resolved or not.
    If not, then try starting the outlook in safe mode using (Outlook.exe /safe) and check the issue again.
    Hopefully, these will resolve your issue.

  • Can"t send epics thru email - (text w pics fine)

    I can send email. I can"t attach a picture from the phone I'm using and send thru email. Works fine sending it thru text
    Solved!
    Go to Solution.

    Try reducing the size of your pictures. Go into the camera app and hit the menu key and select "Options." Change the image size to a smaller size and take a pic and try sending again.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • OSB - send file in email attachment in SOAP attachment

    Hi!
    I would like to send a file in email in SOAP attachment.
    I thought it would be a simple task, I will create a proxy service, which calls a business service. There is a routing action in proxy service to business service and after the rouiting there is a replace action, I replace the attachments variable with this:
    <con:attachment xmlns:con="http://www.bea.com/wli/sb/context">
    <con:Content-Type>application/pdf</con:Content-Type>
    <con:Content-Transfer-Encoding>base64</con:Content-Transfer-Encoding>
    <con:Content-Disposition>attachment; filename="Simple.pdf"</con:Content-Disposition>
    <con:body>{$attachments/ctx:attachment/ctx:body}</con:body>
    </con:attachment>
    I received the email, but i cannot open the document, because it is corrupted...
    Please, could someone help me?
    I can't find out the solution.
    Thanks!
    Viktor

    Hi Anuj!
    Thanks for your answer again! :)
    I tried the blog and I could send email with attachment. My problem is that I have to put the file content into the webservice body when i call the proxy service as a webservice. But I want to put the file into the SOAP attachment. So this is my scenario:
    1. the service counsumer calls the proxy service webservice and the service consumer (client) put the file into the request SOAP attachment
    2. the proxy service calls the business service
    3. the business service sends the email with an attachment (and the file is into this attachment)
    Could You help me?
    Thanks!

  • I been trying to send pictures thru email but it always say my email server didn't recognize my username /password combination... I don't know how to fix it... please help.

    I need help... I been trying to send pictures  in iphoto thru email but it says that may emai server didn't recognize my username/password combination.

    What email service? There have been many reports of issues with Yahoo mail with iPhtoo and with other clients -
    The general answer for iPhoto '11  with e-mail issues is
    in the iPhoto preferences ==> accounts delete your e-mail account and reenter it
    OR
    IMHO the better solution is to set Apple mail as the email client in the iPhoto preferences
    LN

  • How can I send files thru iChat?

    I would like to send some of my music files to my phone but I don't have the option of sending files to my phone. Why not and is there any way I can send files to my cellphone? I've tried the Bluetooth but that tells me I have to wait 9 hrs. Is there another way that's faster?
    Thank you
    Tamara

    That's probably your SIM card (the 32MB card in the phone).
    An alternative way would be to upload the files to a webhost (you can make a free website basically anywhere on the web, tripod.com comes to mind). Keep the files to a minimum and watch your bandwidth though because the service is free, Tripod will limit your downloads/uploads to something like 10MB/day which is crazy small.
    Once the file is uploaded to your webhost, use your phones WAP browser and punch in the direct link to the file and it should download. Keep in mind that you WILL BE CHARGED for downloading data onto your phone unless your phone plan incorporates that already.
    Hope this helps,
    -Ryan

  • Send File Through Email -- Size Limit?

    Is there a size limit to files that can be sent using SMTP functions?
    I know in different mail servers, there are restrictions on how large attached files can be.
    Is this true in LabVIEW? What server does LabVIEW send through, your default email server or something else?
    Cory K
    Solved!
    Go to Solution.

    It uses the server that you specify.
    Message Edited by Dennis Knutson on 02-26-2009 09:59 AM
    Attachments:
    SMTP File Send.PNG ‏18 KB

Maybe you are looking for