How to send email with an attachment?

Runtime.getRuntime().exec("cmd /c start mailto:)
what should I add in order to send email?
10x

Have you tried looking at the JavaMail libraries.
http://www.google.co.uk/search?q=JavaMail+attachment

Similar Messages

  • Send email with XMl attachment

    Hi All,
    My requrement are, to send emails to particular person "PDF" attachment and "XML" attachments.
    i did pdf by using convert spool to pef and send email to that vendor.its working .
    But i dnt know how to send email with XML attachment.Is there any function for convert spool to xml and email to that vendor.Please send me code ASAP.
    i have to sumbit this object soon.Please help me regarding this issue.
    Abhi...

    Hi,
       Try this out.
    ISR_FI_SEND_EMAIL
    ISR_FI_SEND_EMAIL_NEW_USER
    SLS_CUST_SEND_EMAIL_TOOL
    OR
    report y_cr17_mail.
    data method1 like sy-ucomm.
    data g_user like soudnamei1.
    data g_user_data like soudatai1.
    data g_owner like soud-usrnam.
    data g_receipients like soos1 occurs 0 with header line.
    data g_document like sood4 .
    data g_header like sood2.
    data g_folmam like sofm2.
    data g_objcnt like soli occurs 0 with header line.
    data g_objhead like soli occurs 0 with header line.
    data g_objpara like selc occurs 0 with header line.
    data g_objparb like soop1 occurs 0 with header line.
    data g_attachments like sood5 occurs 0 with header line.
    data g_references like soxrl occurs 0 with header line.
    data g_authority like sofa-usracc.
    data g_ref_document like sood4.
    data g_new_parent like soodk.
    data: begin of g_files occurs 10 ,
    text(4096) type c,
    end of g_files.
    data : fold_number(12) type c,
    fold_yr(2) type c,
    fold_type(3) type c.
    parameters ws_file(4096) type c default 'c:\debugger.txt'.
    Can me any file fromyour pc ....either xls or word or ppt etc ...
    g_user-sapname = sy-uname.
    call function 'SO_USER_READ_API1'
    exporting
    user = g_user
    PREPARE_FOR_FOLDER_ACCESS = ' '
    importing
    user_data = g_user_data
    EXCEPTIONS
    USER_NOT_EXIST = 1
    PARAMETER_ERROR = 2
    X_ERROR = 3
    OTHERS = 4
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    fold_type = g_user_data-outboxfol+0(3).
    fold_yr = g_user_data-outboxfol+3(2).
    fold_number = g_user_data-outboxfol+5(12).
    clear g_files.
    refresh : g_objcnt,
    g_objhead,
    g_objpara,
    g_objparb,
    g_receipients,
    g_attachments,
    g_references,
    g_files.
    method1 = 'SAVE'.
    g_document-foltp = fold_type.
    g_document-folyr = fold_yr.
    g_document-folno = fold_number.
    g_document-objtp = g_user_data-object_typ.
    *g_document-OBJYR = '27'.
    *g_document-OBJNO = '000000002365'.
    *g_document-OBJNAM = 'MESSAGE'.
    g_document-objdes = 'sap-img.com testing by program'.
    g_document-folrg = 'O'.
    *g_document-okcode = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'TXT'.
    g_header-objdes = 'sap-img.com testing by program'.
    g_header-file_ext = 'TXT'.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = sy-uname
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header
    FOLMEM_DATA =
    RECEIVE_DATA =
    File from the pc to send...
    method1 = 'ATTCREATEFROMPC'.
    g_files-text = ws_file.
    append g_files.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = g_owner
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header
    method1 = 'SEND'.
    g_receipients-recnam = 'MK085'.
    g_receipients-recesc = 'B'.
    g_receipients-sndex = 'X'.
    append g_receipients.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = g_owner
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header.
    *-- End of Program
    Also check this links as well.
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
    Hope this will help.
    Regards

  • I have Windows 7, Microsoft Outlook and PSE 13. I have used the "Share photos as embedded images" feature frequently, but today when I went to use it, it wasn't there, only the option to send email with files attached. How do I get back the ability to sen

    I have Windows 7, Microsoft Outlook and PSE 13. I have used the "Share photos as embedded images" feature frequently, but today when I went to use it, it wasn't there, only the option to send email with files attached. How do I get back the ability to send emails with photos embedded. I like adding the frames and backgrounds and I think it's easier for recipients to look at the photos. Thanks for any suggestions of things to try.
    Gail

    I had a similar problem in that my wife's iphone 5 could not send pics with imessage.  Had to set the settings to default to SMS or whatever.  After laboring many hours on the web I coincidentally was on the phone with the internet people to question my internet speed.  They changed the router channel, which is something that I am capable of doing myself.  After that, the pics go over imessage.  My own Iphone didn't have the problem.  We are both latest IOS 7.0.6.

  • How do I send email with pictures attached, using PSE 9 and Windows 7 ?

    How do I send email with pictures attached, using PSE 9 and Windows 7 ?

    Try email attachment workflow in Organizer. http://tv.adobe.com/watch/learn-photoshop-elements-9/sharing-your-images-via-email/
    Thanks
    Andaleeb

  • I am have trouble sending email with an attachment?

    I am having trouble sending emails with an attachment.  Does anyone have a solution to this problem?

    Impossible to answer with information provided
    Allan

  • Unable to send email with an attachement (photo) through activesync (zarafa) after upgrading to ios8

    Hello,
    I just upgrading to ios 8 (8.0.2) and I am now unable to send email with an attachement (photo) through activesync (zarafa).
    It works fine with smtp or through activesync but without attachement.
    Is there any solution?
    Thx.

    It worked fine with the last version of iOS 7 and still works fine with outlook connected from a PC to the same activesync server.

  • Command to send email with graphic attachment

    Which command would you recommend to send an email from the commandline with a picture attachment? I have read that the "mail" command does not handle attachments.

    Hi Mahongue,
       I apologize for the late reply but that's part of the difficulties associated with posing the questions in so many threads. OK, I confess; I am also very late in reading Michael's link. Of course I wouldn't have recognized the script before answering on another of your threads. The script in the MacOSXHint to which Michael linked is a version of Dave Wotton's mail_files script to which you linked. Thus, I see now why you didn't know how to do that in Perl. Therefore I did a little searching for you.
       It seems as though the simplest way of e-mailing an attachment in Perl is with MIME::Lite. That isn't installed by default but is easily installed with the CPAN shell. The Perl script that I found most often is mailattach, which uses MIME::Lite. You can find a large number of such scripts at the Perl Archive: Emailing/With Attachments. However, possibly my favorite discussion of it was found on a page about How to send email attachments using Perl / MIME::Lite. There is a very simple example on that page.
       MIME::Lite will not only encode the attachment and include it in the e-mail message, it will also send the message. There are several other Perl packages that can send attachments and most of them probably also send the message but that's trivial to do with Perl regardless. One of the examples I found even invoked sendmail from within the Perl.
    Gary
    ~~~~
       You're all clear now, kid. Now blow this thing so we can
       all go home.
             -- Han Solo

  • How to send Email with attachments

    Hi im Trying to send a file as attachment using EMail Activity operator.
    Can we do it using Email activity? If yes, then how can we do it? If no, then please tell me about any other method using which i can send a email with attachments.
    Regards
    Vibhuti

    Better late than never, a comprehensive demo on the topic:
    REM
    REM maildemo.sql - A PL/SQL package to demonstrate how to use the UTL_SMTP
    REM package to send emails in ASCII and non-ASCII character sets, emails
    REM with text or binary attachments.
    REM
    REM Note: this package relies on the UTL_ENCODE PL/SQL package in Oracle 9i.
    CREATE OR REPLACE PACKAGE demo_mail IS
      ----------------------- Customizable Section -----------------------
      -- Customize the SMTP host, port and your domain name below.
      smtp_host   VARCHAR2(256) := 'smtp-server.some-company.com';
      smtp_port   PLS_INTEGER   := 25;
      smtp_domain VARCHAR2(256) := 'some-company.com';
      -- Customize the signature that will appear in the email's MIME header.
      -- Useful for versioning.
      MAILER_ID   CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
      --------------------- End Customizable Section ---------------------
      -- A unique string that demarcates boundaries of parts in a multi-part email
      -- The string should not appear inside the body of any part of the email.
      -- Customize this if needed or generate this randomly dynamically.
      BOUNDARY        CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
      FIRST_BOUNDARY  CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
      LAST_BOUNDARY   CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
                                                  utl_tcp.CRLF;
      -- A MIME type that denotes multi-part email (MIME) messages.
      MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
                                                      BOUNDARY || '"';
      MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER   := 76 / 4 * 3;
      -- A simple email API for sending email in plain text in a single call.
      -- The format of an email address is one of these:
      --   someone@some-domain
      --   "Someone at some domain" <someone@some-domain>
      --   Someone at some domain <someone@some-domain>
      -- The recipients is a list of email addresses  separated by
      -- either a "," or a ";"
      PROCEDURE mail(sender     IN VARCHAR2,
               recipients IN VARCHAR2,
               subject    IN VARCHAR2,
               message    IN VARCHAR2);
      -- Extended email API to send email in HTML or plain text with no size limit.
      -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
      -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
      -- email in non-ASCII or multi-byte character set. End the email with
      -- end_mail().
      FUNCTION begin_mail(sender     IN VARCHAR2,
                    recipients IN VARCHAR2,
                    subject    IN VARCHAR2,
                    mime_type  IN VARCHAR2    DEFAULT 'text/plain',
                    priority   IN PLS_INTEGER DEFAULT NULL)
                    RETURN utl_smtp.connection;
      -- Write email body in ASCII
      PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN VARCHAR2);
      -- Write email body in non-ASCII (including multi-byte). The email body
      -- will be sent in the database character set.
      PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN            VARCHAR2);
      -- Write email body in binary
      PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
                    message IN RAW);
      -- APIs to send email with attachments. Attachments are sent by sending
      -- emails in "multipart/mixed" MIME format. Specify that MIME format when
      -- beginning an email with begin_mail().
      -- Send a single text attachment.
      PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
                   data         IN VARCHAR2,
                   mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                   inline       IN BOOLEAN  DEFAULT TRUE,
                   filename     IN VARCHAR2 DEFAULT NULL,
                      last         IN BOOLEAN  DEFAULT FALSE);
      -- Send a binary attachment. The attachment will be encoded in Base-64
      -- encoding format.
      PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
                     data         IN RAW,
                     mime_type    IN VARCHAR2 DEFAULT 'application/octet',
                     inline       IN BOOLEAN  DEFAULT TRUE,
                     filename     IN VARCHAR2 DEFAULT NULL,
                     last         IN BOOLEAN  DEFAULT FALSE);
      -- Send an attachment with no size limit. First, begin the attachment
      -- with begin_attachment(). Then, call write_text repeatedly to send
      -- the attachment piece-by-piece. If the attachment is text-based but
      -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
      -- To send binary attachment, the binary content should first be
      -- encoded in Base-64 encoding format using the demo package for 8i,
      -- or the native one in 9i. End the attachment with end_attachment.
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                        mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                        inline       IN BOOLEAN  DEFAULT TRUE,
                        filename     IN VARCHAR2 DEFAULT NULL,
                        transfer_enc IN VARCHAR2 DEFAULT NULL);
      -- End the attachment.
      PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                      last IN BOOLEAN DEFAULT FALSE);
      -- End the email.
      PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
      -- Extended email API to send multiple emails in a session for better
      -- performance. First, begin an email session with begin_session.
      -- Then, begin each email with a session by calling begin_mail_in_session
      -- instead of begin_mail. End the email with end_mail_in_session instead
      -- of end_mail. End the email session by end_session.
      FUNCTION begin_session RETURN utl_smtp.connection;
      -- Begin an email in a session.
      PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                          sender     IN VARCHAR2,
                          recipients IN VARCHAR2,
                          subject    IN VARCHAR2,
                          mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                          priority   IN PLS_INTEGER DEFAULT NULL);
      -- End an email in a session.
      PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
      -- End an email session.
      PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;
    CREATE OR REPLACE PACKAGE BODY demo_mail IS
      -- Return the next email address in the list of email addresses, separated
      -- by either a "," or a ";".  The format of mailbox may be in one of these:
      --   someone@some-domain
      --   "Someone at some domain" <someone@some-domain>
      --   Someone at some domain <someone@some-domain>
      FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
        addr VARCHAR2(256);
        i    pls_integer;
        FUNCTION lookup_unquoted_char(str  IN VARCHAR2,
                          chrs IN VARCHAR2) RETURN pls_integer AS
          c            VARCHAR2(5);
          i            pls_integer;
          len          pls_integer;
          inside_quote BOOLEAN;
        BEGIN
           inside_quote := false;
           i := 1;
           len := length(str);
           WHILE (i <= len) LOOP
          c := substr(str, i, 1);
          IF (inside_quote) THEN
            IF (c = '"') THEN
              inside_quote := false;
            ELSIF (c = '\') THEN
              i := i + 1; -- Skip the quote character
            END IF;
            GOTO next_char;
          END IF;
          IF (c = '"') THEN
            inside_quote := true;
            GOTO next_char;
          END IF;
          IF (instr(chrs, c) >= 1) THEN
             RETURN i;
          END IF;
          <<next_char>>
          i := i + 1;
           END LOOP;
           RETURN 0;
        END;
      BEGIN
        addr_list := ltrim(addr_list);
        i := lookup_unquoted_char(addr_list, ',;');
        IF (i >= 1) THEN
          addr      := substr(addr_list, 1, i - 1);
          addr_list := substr(addr_list, i + 1);
        ELSE
          addr := addr_list;
          addr_list := '';
        END IF;
        i := lookup_unquoted_char(addr, '<');
        IF (i >= 1) THEN
          addr := substr(addr, i + 1);
          i := instr(addr, '>');
          IF (i >= 1) THEN
         addr := substr(addr, 1, i - 1);
          END IF;
        END IF;
        RETURN addr;
      END;
      -- Write a MIME header
      PROCEDURE write_mime_header(conn  IN OUT NOCOPY utl_smtp.connection,
                         name  IN VARCHAR2,
                         value IN VARCHAR2) IS
      BEGIN
        utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
      END;
      -- Mark a message-part boundary.  Set <last> to TRUE for the last boundary.
      PROCEDURE write_boundary(conn  IN OUT NOCOPY utl_smtp.connection,
                      last  IN            BOOLEAN DEFAULT FALSE) AS
      BEGIN
        IF (last) THEN
          utl_smtp.write_data(conn, LAST_BOUNDARY);
        ELSE
          utl_smtp.write_data(conn, FIRST_BOUNDARY);
        END IF;
      END;
      PROCEDURE mail(sender     IN VARCHAR2,
               recipients IN VARCHAR2,
               subject    IN VARCHAR2,
               message    IN VARCHAR2) IS
        conn utl_smtp.connection;
      BEGIN
        conn := begin_mail(sender, recipients, subject);
        write_text(conn, message);
        end_mail(conn);
      END;
      FUNCTION begin_mail(sender     IN VARCHAR2,
                    recipients IN VARCHAR2,
                    subject    IN VARCHAR2,
                    mime_type  IN VARCHAR2    DEFAULT 'text/plain',
                    priority   IN PLS_INTEGER DEFAULT NULL)
                    RETURN utl_smtp.connection IS
        conn utl_smtp.connection;
      BEGIN
        conn := begin_session;
        begin_mail_in_session(conn, sender, recipients, subject, mime_type,
          priority);
        RETURN conn;
      END;
      PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN VARCHAR2) IS
      BEGIN
        utl_smtp.write_data(conn, message);
      END;
      PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN            VARCHAR2) IS
      BEGIN
        utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
      END;
      PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
                    message IN RAW) IS
      BEGIN
        utl_smtp.write_raw_data(conn, message);
      END;
      PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
                   data         IN VARCHAR2,
                   mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                   inline       IN BOOLEAN  DEFAULT TRUE,
                   filename     IN VARCHAR2 DEFAULT NULL,
                      last         IN BOOLEAN  DEFAULT FALSE) IS
      BEGIN
        begin_attachment(conn, mime_type, inline, filename);
        write_text(conn, data);
        end_attachment(conn, last);
      END;
      PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
                     data         IN RAW,
                     mime_type    IN VARCHAR2 DEFAULT 'application/octet',
                     inline       IN BOOLEAN  DEFAULT TRUE,
                     filename     IN VARCHAR2 DEFAULT NULL,
                     last         IN BOOLEAN  DEFAULT FALSE) IS
        i   PLS_INTEGER;
        len PLS_INTEGER;
      BEGIN
        begin_attachment(conn, mime_type, inline, filename, 'base64');
        -- Split the Base64-encoded attachment into multiple lines
        i   := 1;
        len := utl_raw.length(data);
        WHILE (i < len) LOOP
           IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
          utl_smtp.write_raw_data(conn,
             utl_encode.base64_encode(utl_raw.substr(data, i,
             MAX_BASE64_LINE_WIDTH)));
           ELSE
          utl_smtp.write_raw_data(conn,
            utl_encode.base64_encode(utl_raw.substr(data, i)));
           END IF;
           utl_smtp.write_data(conn, utl_tcp.CRLF);
           i := i + MAX_BASE64_LINE_WIDTH;
        END LOOP;
        end_attachment(conn, last);
      END;
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                        mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                        inline       IN BOOLEAN  DEFAULT TRUE,
                        filename     IN VARCHAR2 DEFAULT NULL,
                        transfer_enc IN VARCHAR2 DEFAULT NULL) IS
      BEGIN
        write_boundary(conn);
        write_mime_header(conn, 'Content-Type', mime_type);
        IF (filename IS NOT NULL) THEN
           IF (inline) THEN
           write_mime_header(conn, 'Content-Disposition',
             'inline; filename="'||filename||'"');
           ELSE
           write_mime_header(conn, 'Content-Disposition',
             'attachment; filename="'||filename||'"');
           END IF;
        END IF;
        IF (transfer_enc IS NOT NULL) THEN
          write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
        END IF;
        utl_smtp.write_data(conn, utl_tcp.CRLF);
      END;
      PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                      last IN BOOLEAN DEFAULT FALSE) IS
      BEGIN
        utl_smtp.write_data(conn, utl_tcp.CRLF);
        IF (last) THEN
          write_boundary(conn, last);
        END IF;
      END;
      PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        end_mail_in_session(conn);
        end_session(conn);
      END;
      FUNCTION begin_session RETURN utl_smtp.connection IS
        conn utl_smtp.connection;
      BEGIN
        -- open SMTP connection
        conn := utl_smtp.open_connection(smtp_host, smtp_port);
        utl_smtp.helo(conn, smtp_domain);
        RETURN conn;
      END;
      PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                          sender     IN VARCHAR2,
                          recipients IN VARCHAR2,
                          subject    IN VARCHAR2,
                          mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                          priority   IN PLS_INTEGER DEFAULT NULL) IS
        my_recipients VARCHAR2(32767) := recipients;
        my_sender     VARCHAR2(32767) := sender;
      BEGIN
        -- Specify sender's address (our server allows bogus address
        -- as long as it is a full email address ([email protected]).
        utl_smtp.mail(conn, get_address(my_sender));
        -- Specify recipient(s) of the email.
        WHILE (my_recipients IS NOT NULL) LOOP
          utl_smtp.rcpt(conn, get_address(my_recipients));
        END LOOP;
        -- Start body of email
        utl_smtp.open_data(conn);
        -- Set "From" MIME header
        write_mime_header(conn, 'From', sender);
        -- Set "To" MIME header
        write_mime_header(conn, 'To', recipients);
        -- Set "Subject" MIME header
        write_mime_header(conn, 'Subject', subject);
        -- Set "Content-Type" MIME header
        write_mime_header(conn, 'Content-Type', mime_type);
        -- Set "X-Mailer" MIME header
        write_mime_header(conn, 'X-Mailer', MAILER_ID);
        -- Set priority:
        --   High      Normal       Low
        --   1     2     3     4     5
        IF (priority IS NOT NULL) THEN
          write_mime_header(conn, 'X-Priority', priority);
        END IF;
        -- Send an empty line to denotes end of MIME headers and
        -- beginning of message body.
        utl_smtp.write_data(conn, utl_tcp.CRLF);
        IF (mime_type LIKE 'multipart/mixed%') THEN
          write_text(conn, 'This is a multi-part message in MIME format.' ||
         utl_tcp.crlf);
        END IF;
      END;
      PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        utl_smtp.close_data(conn);
      END;
      PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        utl_smtp.quit(conn);
      END;
    END;
    /

  • Send Email with Multiple Attachment

    Hi,
    How do you send an email with multiple attachment of different types thru SO_NEW_DOCUMENT_ATT_SEND_API1?
    Please help.
    Tyken

    Hi,
    Try this code.
    This program will allowed you to send email with attachment.
    First, specify the attachment file from your local hardisk and execute.
    Next, specify the sender email address and click the send button.
    Written by : SAP Basis, ABAP Programming and Other IMG Stuff
                   http://www.sap-img.com
    report y_cr17_mail.
    data method1 like sy-ucomm.
    data g_user like soudnamei1.
    data g_user_data like soudatai1.
    data g_owner like soud-usrnam.
    data g_receipients like soos1 occurs 0 with header line.
    data g_document like sood4 .
    data g_header like sood2.
    data g_folmam like sofm2.
    data g_objcnt like soli occurs 0 with header line.
    data g_objhead like soli occurs 0 with header line.
    data g_objpara  like selc occurs 0 with header line.
    data g_objparb  like soop1 occurs 0 with header line.
    data g_attachments like sood5 occurs 0 with header line.
    data g_references like soxrl occurs 0 with header line.
    data g_authority like sofa-usracc.
    data g_ref_document like sood4.
    data g_new_parent like soodk.
    data: begin of g_files occurs 10 ,
      text(4096) type c,
       end of g_files.
    data : fold_number(12) type c,
           fold_yr(2) type c,
           fold_type(3) type c.
    parameters ws_file(4096) type c default 'c:\debugger.txt'.
    Can me any file fromyour pc ....either xls or word or ppt etc ...
    g_user-sapname = sy-uname.
    call function 'SO_USER_READ_API1'
    exporting
       user                            = g_user
       PREPARE_FOR_FOLDER_ACCESS       = ' '
    importing
       user_data                       = g_user_data
    EXCEPTIONS
       USER_NOT_EXIST                  = 1
       PARAMETER_ERROR                 = 2
       X_ERROR                         = 3
       OTHERS                          = 4
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    fold_type = g_user_data-outboxfol+0(3).
    fold_yr = g_user_data-outboxfol+3(2).
    fold_number =  g_user_data-outboxfol+5(12).
    clear g_files.
    refresh : g_objcnt,
      g_objhead,
      g_objpara,
      g_objparb,
      g_receipients,
      g_attachments,
      g_references,
      g_files.
    method1 = 'SAVE'.
    g_document-foltp  = fold_type.
    g_document-folyr   = fold_yr.
    g_document-folno   = fold_number.
    g_document-objtp   = g_user_data-object_typ.
    *g_document-OBJYR   = '27'.
    *g_document-OBJNO   = '000000002365'.
    *g_document-OBJNAM = 'MESSAGE'.
    g_document-objdes   = 'sap-img.com testing by program'.
    g_document-folrg   = 'O'.
    *g_document-okcode   = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'TXT'.
    g_header-objdes =  'sap-img.com testing by program'.
    g_header-file_ext = 'TXT'.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = sy-uname
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header
      FOLMEM_DATA        =
      RECEIVE_DATA       =
    File from the pc to send...
    method1 = 'ATTCREATEFROMPC'.
    g_files-text = ws_file.
    append g_files.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = g_owner
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header
    method1 = 'SEND'.
    g_receipients-recnam = 'MK085'.
    g_receipients-recesc = 'B'.
    g_receipients-sndex = 'X'.
    append  g_receipients.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
      exporting
        method             = method1
       office_user        = g_owner
       ref_document       = g_ref_document
       new_parent         =  g_new_parent
    importing
       authority          =  g_authority
    tables
       objcont            = g_objcnt
       objhead            = g_objhead
       objpara            = g_objpara
       objparb            = g_objparb
       recipients         = g_receipients
       attachments        = g_attachments
       references         = g_references
       files              = g_files
      changing
        document           = g_document
       header_data        = g_header.
    *-- End of Program
    Reward pts if usefull.
    Regards,
    Dhan

  • Send email with PDF attachements (Smartform/SAP script)

    Hello All,
    I have 3 existing programs A, B & C whose output is in SAP Script/Smartform. Now I need to create new program D which needs to execute program A, B & C and then convert their smartform/SAP script output into PDF format and send email with attachements (PDF files). Any pointers how I can proceed. Thanks a lot.

    hi Sarita,
      v_ctrlparams-no_dialog = 'X'.
      v_ctrlparams-getotf = 'X'.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname = 'Smartform name'
        IMPORTING
          fm_name  = v_func_mod.
      CALL FUNCTION v_func_mod
        EXPORTING
          control_parameters = v_ctrlparams
        IMPORTING
          job_output_info    = v_joboutput
        TABLES
          t_nonsigner        = t_nonsigner.
    fill the document
      doc_chng-obj_name = 'Descriptoipn'.
    Fill the subject line
    doc_chng-obj_descr = 'Manpowe'.
      doc_chng-obj_descr = 'Reminder .
      doc_chng-sensitivty = 'P'.
    Fill the content of the mail
      objcont = 'Dear all,'.
      APPEND objcont.
      CLEAR objcont.
      APPEND objcont.
      CLEAR objcont.
      objcont =
    'The manpower sign-off is pending for the list of employees as per th' &
    'e attached sheet.'
      APPEND objcont.
      CLEAR objcont.
      APPEND objcont.
      CLEAR objcont.
      objcont =
      'Please click on the following link for the manpower sign-off:'.
      APPEND objcont.
      CLEAR objcont.
      APPEND objcont.
      CLEAR objcont.
      DESCRIBE TABLE objcont LINES entries.
      READ TABLE objcont INDEX entries.
      doc_chng-doc_size = ( entries - 1 ) * 255 + STRLEN( objcont ).
    Creating the entry for the compressed document
      CLEAR objpack-transf_bin.
      objpack-head_start = 1.
      objpack-head_num   = 0.
      objpack-body_start = 1.
      objpack-body_num   = entries.
      objpack-doc_type   = 'RAW'.
      APPEND objpack.
    Creating the document attachment
    (Assume the data in OBJBIN are given in BMP format)
      LOOP AT v_joboutput-otfdata INTO wa_otfdata.
        APPEND wa_otfdata TO objbin.
        CLEAR wa_otfdata.
      ENDLOOP.
      DESCRIBE TABLE objbin LINES tab_lines.
      objhead = 'NonSignerDetails.otf'. APPEND objhead.
    Creating the entry for the compressed attachment
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num   = 1.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'OTF'.
      objpack-obj_name   = 'ATTACHMENT'.
      objpack-obj_descr = 'NonSignerDetails'.
      objpack-doc_size   = tab_lines * 255.
      APPEND objpack.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc_chng
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = objpack
          object_header              = objhead
          contents_bin               = objbin
          contents_txt               = objcont
          receivers                  = reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
    hope this will help u..
    regards,
    Santosh Thorat

  • Send Email with Excel attachment with formatting(bold, color) in Background

    Hi,
    I have requirement wherein I have to send an email with excel attachment with proper formatting of certain fields in the excel sheet like making it bold or setting different color. The data is available in an internal table. Just to to format it and send an email when the program is executed in background mode.
    Any pointers on this would be highly appreciated!
    Thanks,
    Anil.

    I  resolved my own problem using the BCS_EXAMPLE_7 program as sample.

  • Set a specific time to send email with an attachment ? Possible ?

    Is it possible to set a specific time to send an email with an attachment automatically ?
    if yes, what is the trick for Mail 4.4.
    Thanks in Advance.

    Open Automator, click on Mail on the left pane and look around. The description of each action is pretty good.
    Pretty much your workflow should look like something like this:
    *Get specified finder items
    *New mail message
    *Send outgoing messages
    Message was edited by: WBW

  • How to send Email with Cc and Bcc using MailPackage

    Hi ,
    we are using Mail Package to send the Email using Mail Adapter.We have a requirement where we need to send Email with Cc and Bcc using Mail Package .
    Can we send Cc and Bcc using Mail Package ?
    Thanks
    Rajesh .

    HI Rajesh,
    There is a standard structure for Receiver Mail adopter which we can get from SAP market Place but it is not provided with CC if u want to use CC then you have to go with Dynamic Configuration.
    DynamicConfiguration configuration = (DynamicConfiguration) container.getTransformationParameters().getStreamTransformationConstants.DYNAMIC_CONFIGURATION);
    /*any other required fields*/
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Mail", "THeaderCC");
    configuration.put(key, "ccemail @ test.com");
    Regards
    Praveen Reddy
    Edited by: Maareddy Praveen Reddy on Aug 10, 2011 12:17 PM

  • How to send email with attachment

    Hi friends,
    I am using soa 11.1.1.7.0
    Jdev 11.1.1.7.0
    WebLogic:- 10.3
    I want to generated email with attachment in BPEL 11g. Below is what i did in my bpel process
    Create simple hello world bpel process.
    In email activity below details are given
    <scope name="Email1">
    <bpelx:annotation>
    <bpelx:pattern patternName="bpelx:email"></bpelx:pattern>
    </bpelx:annotation>
       <variables>
       <variable name="varNotificationReq"
                              messageType="ns1:EmailNotificationRequest"/>
                    <variable name="varNotificationResponse"
                              messageType="ns1:ArrayOfResponse"/>
                    <variable name="NotificationServiceFaultVariable"
                              messageType="ns1:NotificationServiceErrorMessage"/>
                </variables>
                <sequence name="Sequence1">
                    <assign name="EmailParamsAssign">
                        <copy>
                            <from expression="string('Default')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:FromAccountName"/>
                        </copy>
                        <copy>
                            <from expression="string('')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:FromUserName"/>
                        </copy>
                        <copy>
                            <from expression="string('')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Bcc"/>
                        </copy>
                        <copy>
                            <from expression="string('')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Cc"/>
                        </copy>
                        <copy>
                            <from expression="string('')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:ReplyToAddress"/>
                        </copy>
                        <copy>
                            <from expression="bpws:getVariableData('inputVariable','payload','/client:process/client:subject')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Subject"/>
                        </copy>
                        <copy>
                            <from expression="bpws:getVariableData('inputVariable','payload','/client:process/client:to')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:To"/>
                        </copy>
                        <copy>
                            <from><Content xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"><MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">multipart/mixed</MimeType><ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"><MultiPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"> <BodyPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"><MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/><ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/><BodyPartName xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/></BodyPart> <BodyPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"><MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/><ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/><BodyPartName xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/></BodyPart></MultiPart></ContentBody></Content></from>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Content"/>
                        </copy>
                        <copy>
                            <from expression="string('text/html; charset=UTF-8')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[1]/ns1:MimeType"/>
                        </copy>
                        <copy>
                            <from expression="bpws:getVariableData('inputVariable','payload','/client:process/client:body')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[1]/ns1:ContentBody"/>
                        </copy>
                        <copy>
                            <from expression="string('text/plain')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:MimeType"/>
                        </copy>
                        <copy>
                            <from expression="string('SampleStudent.txt')"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:BodyPartName"/>
                        </copy>
                        <copy>
                            <from expression="concat('file:///', bpws:getVariableData('inputVariable','payload','/client:process/client:attachmentURI'))"/>
                            <to variable="varNotificationReq" part="EmailPayload"
                                query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:ContentBody"/>
                        </copy>                
                    </assign>
                    <invoke name="InvokeNotificationService"
                            portType="ns1:NotificationService"
                            partnerLink="NotificationService1"
                            inputVariable="varNotificationReq"
                            outputVariable="varNotificationResponse"
                            operation="sendEmailNotification"/>
                </sequence>
            </scope>
            <!--
              Asynchronous callback to the requester. (Note: the callback location and correlation id is transparently handled using WS-addressing.)
            -->
            <invoke name="callbackClient"
                    partnerLink="sendingemailwithattachmentsprcs_client"
                    portType="client:SendingEmailWithAttachmentsPrcsCallback"
                    operation="processResponse" inputVariable="outputVariable"/>
        </sequence>
    </process>
    I am able to generate Email with attachment but i cant see the data in the attached file.
    I think i need to convert the data before sending as a attachment. Could someone please help me in generating the txt files.
    Regards,
    Rajireddy.

    Re: sending fax

  • How to send emails with attachments??

    Hi all,
    I am search for how to send an email with attachment. I can send a simple email using mailto and as far as my knowledge goes it do not have a support for sending an attachment.

    Hi all,
    I am search for how to send an email with attachment. I can send a simple email using mailto and as far as my knowledge goes it do not have a support for sending an attachment.

Maybe you are looking for

  • Adobe Acrobat Pro 9 problem

    Software:Adobe Acrobat Pro 9 problem Issue: Whenever the end-user runs the PDF maker in Word 2003, it converts the file fine but when you close the PDF and return to the Word document, it shows the progress bar is still working to create the PDF. Rel

  • How do I hide grid lines in printing?

    I want to print a spreadsheet without the grid lines around each cell. I there a way to do this?

  • Everything's in Spanish!

    Hi. I'm trying to help my mom. She lives in Mexico. I downloaded iTunes onto her computer, but when I try to set up an apple ID for her, all the documentation is in Spanish! We need it in English. Before I downloaded, it asked my location and I check

  • PSE 6 - registration problem

    I am so incredibly frustrated with Adobe right now. I have been happily using PSE6 for my work for 4 years. Last week, upon opening the program I got a white blank box instead of the registration box that I have skipped for 4 years (lesson learned).

  • Trade Dreamweaver CS3 Mac version for PC version.

    Hello all,     I just mistakenly bought Dreamweaver CS3 Mac edition off of ebay. I need the PC version. Is anyone interested in trading versions or can anyone point me to somewhere that this is possible? Switching editions seems to be fairly common s