Email file attachments using utl_smtp

I would like to attach a PDF file to an e-mail. The PDF file
will be generated from Oracle Reports. I will send the e-mail
from Oracle Forms using the utl_smtp procedure. The email will
have some text in the body of the email and I would like to
attach the PDF file.
I have know how to send an emial using the utl_smtp procedure
with a subject and body text. I have seen an example of how to
attach in-line text, but wasn't sure how to attache a file.
In example It appears that the attached text file is generated
from inline text and they are not attaching a Text File.
Can anyone help.
P.S. I am doing this both from the WEB and Client Server

The issue has to do with the space in filename in the utl_http.begin_request. I got it fixed. Thanks

Similar Messages

  • Email file attachments in Gmail on Mac

    When I use Macmail I can easily click an email file attachments through gmail withoiut saving them. Not so when I go through gmail on Firefox. When I click the file attachment in gmail using Firefox it prompts me to save it instead of just opening it up. I don't want to store the file. The hundreds of of file I need to just look at and not file are clogging up my hard drive. I am using Macpro with Snow Leopard.
    HELP.

    Hi  ,
    There may be some limitation  for SAp mail size  attachment  but  Please check with your Administrator Team  who handles  Mail server . Because Company Generally has Policy for Mail Attahcment Size   upto say 5 MB or 10 MB  .
    Regards
    Deepak.

  • How to remove file attachments using the SDK

    I am looking for ways to programmatically remove file attachments from work items.  If I recall correctly, the system only keeps the file for as long as the relationship exists, so that, in theory, the file is deleted from the database a soon as the
    relationship is removed.
    I found this
    Using the SDK to Create and Edit Objects and Relationships Using Type Projections
    Is this the only way or are the other, simpler ways for deleting relationships and/or file attachments?
    Is this something I could do with the Orchestrator Remove Relationship activity?
    A little background on this question: I have multiple different teams with varying data retention requirements for Service Requests.  My longest requirement is 3 years (audit) while most teams only require 90 days.  I was looking to add in some
    jobs for some more aggressive file attachment grooming to keep the database smaller.
    Thanks.

    The relationship is defined as a membership/containment relationship. So, yes, if you delete the relationship, the file attachment (and the associated blob) are deleted as well.
    Based on the background you described, I'm assuming you identify a bunch of work orders whose files you want to delete if they're older than X. So, for instance "Work Items with Y team; delete file attachments older than 90 days", "Work Items
    with Q team; delete file attachments older than 3 years". Is that right?
    If so, you don't necessarily need to delete relationships specifically...you can simply delete the file attachment objects which will delete the relationship, the file attachment object, and the associated blob (the file itself in the database).
    Using the SDK, you will not need type projections for this. You'll only need the work item object(s) (an incident or service request or whatever), the GetRelatedObjects<>() method, and an IncrementalDiscoveryData object.
    So, after you get all of the appropriate work items, you can use the following snippet to delete their file attachments if the attachments meet your age requirements
    //Connect to the management group
    String strMySCSMServer = "<my mgmt server>";
    emg = new EnterpriseManagementGroup(strMySCSMServer);
    IncrementalDiscoveryData idd = new IncrementalDiscoveryData();
    ManagementPackRelationship relWorkItemHasFileAttachment = emg.EntityTypes.GetRelationshipClass(new Guid("AA8C26DC-3A12-5F88-D9C7-753E5A8A55B4")); //System.WorkItemHasFileAttachment
    //Get the work item's related file attachments using it's Id
    Guid myWorkItemGuid = new Guid("<some work item guid>");
    IList<EnterpriseManagementObject> lstFileAttachments = emg.EntityObjects.GetRelatedObjects<EnterpriseManagementObject>(myWorkItemGuid, relWorkItemHasFileAttachment, TraversalDepth.OneLevel, ObjectQueryOptions.Default);
    //Loop through each file attachment
    foreach (EnterpriseManagementObject emoFile in lstFileAttachments)
    //Determine its age
    DateTime AddedDate = (DateTime)emoFile[null, "AddedDate"].Value;
    TimeSpan FileAttachmentAge = AddedDate.Subtract(DateTime.Now);
    //Prep the file attachment for deletion if it's old enough, in this example, older than 90 days
    if (FileAttachmentAge.Days > 90)
    idd.Remove(emoFile);
    //Submit the deletions to the database.
    idd.Commit(emg);

  • Emailing attachments using utl_smtp

    Hi,
    How can one use UTL_SMTP to send a file generated by email as an attachment. I created a MS Excel Spreadsheet on an apps server. I would like to send it as an attachment to recipients.
    Oneway is to use the uuencode in UNIX script.
    But I wanted it to be sent using UTL_SMTP. Could someone please suggest a right direction?
    Thanks
    uds

    Hi Billy,
    Thanks for the updates. My question is how to send a file that is already created as an attachment using UTL_SMTP.
    It is like a truck delivering cargo. It does not make the cargo. In other words, it does construct a completed e-mail for your.
    The file (cargo) is created using UTL_FILE in the apps server. Now I want to use UTL_SMTP to send an email to a list of recipients with this file as an attachment.
    The header that includes data like the e-mail subject, the type of mail and so on. Followed by the body that contains the actual e-mail contents, which includes any attachments
    That is the isuue I am confronting. How do I attach the file already created? Here is the snippet of my code that formulates the body of the email.
    UTL_SMTP.helo (srvr_conn, p_server);
    UTL_SMTP.mail (srvr_conn, p_sender);
    UTL_SMTP.rcpt (srvr_conn, p_recipient);
    UTL_SMTP.open_data (srvr_conn);
    UTL_SMTP.write_data (srvr_conn,
    'Content-Type: text/html' || UTL_TCP.crlf
    UTL_SMTP.write_data (srvr_conn,
    'Subject : Transaction types available'
    || UTL_TCP.crlf
    UTL_SMTP.write_data (srvr_conn, 'To : ' || p_recipient || UTL_TCP.crlf);
    UTL_SMTP.write_data
    (srvr_conn,
    '<br> <html> <body> <table border="1" bordercolor="black">
    <tr>
    <th><font SIZE="2"><b>Trx ID</b></FONT></th>
    <th><font SIZE="2"><b>Trx Code</b></FONT></th>
    </tr>'
    FOR rec IN c1
    LOOP
    UTL_SMTP.write_data (srvr_conn,
    '<tr>
    <td><font SIZE="1">'|| rec.trx_id|| '</FONT></td>
    <td><font SIZE="1">'|| rec.trx_code|| '</FONT></td>
    </tr>'
    END LOOP;
    UTL_SMTP.write_data (srvr_conn, '<br></table></p></body> </html>');
    UTL_SMTP.close_data (srvr_conn);
    UTL_SMTP.quit (srvr_conn);
    Now, how do I ask it to pick the file from server and attach it to the email before "quitting SMTP"? Firstly, can I do that? If yes, can you please suggest me the means how to do it? Your help is much appreciated.
    Thanks
    uds
    PS: c1 is a cursor stmnt; p_server, p_sender, p_recipient are derived from flex values and srvr_conn is type UTL_SMTP.connection

  • Formatting emails:I am using UTL_SMTP package foe sending them.

    Hi
    I created a PL/SQL job to schedule email sending. The code looks like:
    DECLARE
    l_mailhost VARCHAR2(64) := 'qiudubcorrel001.qa.local';
    l_from VARCHAR2(64) := '[email protected]';
    l_to VARCHAR2(64) := '[email protected]';
    l_mail_conn UTL_SMTP.connection;
    BEGIN
    l_mail_conn := UTL_SMTP.open_connection(('10.253.14.240'), 25);
    UTL_SMTP.helo(l_mail_conn, '10.253.14.240');
    UTL_SMTP.mail(l_mail_conn, l_from);
    UTL_SMTP.rcpt(l_mail_conn, l_to);
    UTL_SMTP.data(l_mail_conn, 'Single string message.' || Chr(13));
    UTL_SMTP.quit(l_mail_conn);
    END;
    The code works fine, but now I want to add colour to my email, or introduce other formatting as well. How can I do that here?
    Thanks,
    Kamal

    Here you can find HTML formatting
    * PROCEDURE NAME : XX_EMAIL_FILES
    * DESCRIPTION:
    * ==========
    * Sends e-mail (text and/or html, either as a string or from a file)
    * to one or more recipients (including cc and/or bcc recipients), along with
    * up to 3 file attachments (text and/or binary; default is text/plain), using
    * the UTL_SMTP package to send the e-mail, the DBMS_LOB package to read
    * binary file attachments, and the UTL_ENCODE package to convert the binary
    * attachments to BASE64 for character string (non-binary) transmission.
    * BE AWARE THAT A COMMIT MAY BE DONE BY THIS ROUTINE.
    * PARAMETERS:
    * ==========
    * The complete parameter list for the xx_email_files procedure is shown below:
    * NAME TYPE DESCRIPTION
    * from_name IN Name and e-mail address to put in the From field
    * to_names IN Names and e-mail addresses for the To field (separated by
    * commas or semicolons)
    * subject IN Text string for Subject field
    * message IN Text string or text file name for Message, if any
    * html_message IN Html string or html file name for Message, if any
    * cc_names IN Names and e-mail addresses for the Cc field, if any
    * (separated by commas or semicolons)
    * bcc_names IN Names and e-mail addresses for the Bcc field, if any
    * (separated by commas or semicolons)
    * filename1 IN First unix file pathname to attach, if any
    * filetype1 IN Mime type of first file (defaults to 'text/plain')
    * filename2 IN Second unix file pathname to attach, if any
    * filetype2 IN Mime type of second file (defaults to 'text/plain')
    * filename3 IN Third unix file pathname to attach, if any
    * filetype3 IN Mime type of third file (defaults to 'text/plain')
    * Sample names and e-mail addresses are: arun (attaches @),
    * [email protected], , xxx , and
    * "xxx"
    * A sample call in PL/SQL is shown below, which sends a text and html message,
    * plus a text file and two binary files (note: the slash after "end;" must be
    * the first character on it's line):
    * begin
    * xx_email_files(from_name => '[email protected]' ,
    * to_names => '[email protected]',
    * subject => 'A test',
    * message => 'A TEST MESSAGE',
    * html_message => '
    A test message
    * filename1 => '/ora_appl/oracle/11.5.0/data/xxx.pdf',
    * filename2 => '/usr/tmp/115apug.pdf',
    * filetype2 => 'application/pdf',
    * filename3 => '',
    * filetype3 => 'image/jpeg'
    * end
    * If the message or html_message string has a file name in it (starting with
    * a forward slash), the text or html file is copied into the e-mail as the
    * message or html message; otherwise, the message or html_message is copied
    * into the e-mail as-is.
    * Attachment file types (mime types) that I've tested include:
    * text/plain,
    * text/html,
    * image/jpeg,
    * image/gif,
    * application/pdf,
    * application/msword
    * A list of mime types can be seen at:
    * http://www.webmaster-toolkit.com/mime-types.shtml
    * If the mime type does not begin with "text", it is assumed to be a binary
    * file that will be encoded as base64 before transmission.
    CREATE OR REPLACE PROCEDURE xx_email_files (
    from_name VARCHAR2,
    to_names VARCHAR2,
    subject VARCHAR2,
    MESSAGE VARCHAR2 DEFAULT NULL,
    html_message VARCHAR2 DEFAULT NULL,
    cc_names VARCHAR2 DEFAULT NULL,
    bcc_names VARCHAR2 DEFAULT NULL,
    filename1 VARCHAR2 DEFAULT NULL,
    filetype1 VARCHAR2 DEFAULT 'text/plain',
    filename2 VARCHAR2 DEFAULT NULL,
    filetype2 VARCHAR2 DEFAULT 'text/plain',
    filename3 VARCHAR2 DEFAULT NULL,
    filetype3 VARCHAR2 DEFAULT 'text/plain'
    IS
    -- Change the SMTP host name and port number below to your own values,
    -- if not localhost on port 25:
    smtp_host VARCHAR2 (256) := 'localhost';
    smtp_port NUMBER := 25;
    -- Change the boundary string, if needed, which demarcates boundaries of
    -- parts in a multi-part email, and should not appear inside the body of
    -- any part of the e-mail:
    boundary CONSTANT VARCHAR2 (256) := 'CES.Boundary.DACA587499938898';
    recipients VARCHAR2 (32767);
    directory_path VARCHAR2 (256);
    file_name VARCHAR2 (256);
    crlf VARCHAR2 (2) := CHR (13) || CHR (10);
    mesg VARCHAR2 (32767);
    conn UTL_SMTP.connection;
    l_length NUMBER;
    l_sub VARCHAR2 (32767);
    TYPE varchar2_table IS TABLE OF VARCHAR2 (256)
    INDEX BY BINARY_INTEGER;
    file_array varchar2_table;
    type_array varchar2_table;
    i BINARY_INTEGER;
    -- Function to return the next email address in the list of email addresses,
    -- separated by either a "," or a ";". From Oracle's demo_mail. The format
    -- of mailbox may be in one of these:
    -- someone@some-domain
    -- "Someone at some domain"
    -- Someone at 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
    IS
    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;
    <>
    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;
    -- Procedure to split a file pathname into its directory path and file name
    -- components.
    PROCEDURE split_path_name (
    file_path IN VARCHAR2,
    directory_path OUT VARCHAR2,
    file_name OUT VARCHAR2
    IS
    pos NUMBER;
    BEGIN
    -- Separate the filename from the directory name
    pos := INSTR (file_path, '/', -1);
    IF pos = 0
    THEN
    pos := INSTR (file_path, '\', -1);
    END IF;
    IF pos = 0
    THEN
    directory_path := NULL;
    ELSE
    directory_path := SUBSTR (file_path, 1, pos - 1);
    END IF;
    file_name := SUBSTR (file_path, pos + 1);
    END;
    -- Procedure to append a file's contents to the e-mail
    PROCEDURE append_file (
    directory_path IN VARCHAR2,
    file_name IN VARCHAR2,
    file_type IN VARCHAR2,
    conn IN OUT UTL_SMTP.connection
    IS
    generated_name VARCHAR2 (30)
    := 'CESDIR' || TO_CHAR (SYSDATE, 'HH24MISS');
    directory_name VARCHAR2 (30);
    file_handle UTL_FILE.file_type;
    bfile_handle BFILE;
    bfile_len NUMBER;
    pos NUMBER;
    read_bytes NUMBER;
    line VARCHAR2 (1000);
    DATA RAW (200);
    my_code NUMBER;
    my_errm VARCHAR2 (32767);
    BEGIN
    BEGIN
    -- Grant access to the directory, unless already defined, and open
    -- the file (as a bfile for a binary file, otherwise as a text file).
    BEGIN
    line := directory_path;
    SELECT dd.directory_name
    INTO directory_name
    FROM dba_directories dd
    WHERE dd.directory_path = line AND ROWNUM = 1;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    directory_name := generated_name;
    END;
    IF directory_name = generated_name
    THEN
    EXECUTE IMMEDIATE 'create or replace directory '
    || directory_name
    || ' as '''
    || directory_path
    || '''';
    EXECUTE IMMEDIATE 'grant read on directory '
    || directory_name
    || ' to public';
    END IF;
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    bfile_handle := BFILENAME (directory_name, file_name);
    bfile_len := DBMS_LOB.getlength (bfile_handle);
    pos := 1;
    DBMS_LOB.OPEN (bfile_handle, DBMS_LOB.lob_readonly);
    ELSE
    file_handle := UTL_FILE.fopen (directory_name, file_name, 'r');
    END IF;
    -- Append the file contents to the end of the message
    LOOP
    -- If it is a binary file, process it 57 bytes at a time,
    -- reading them in with a LOB read, encoding them in BASE64,
    -- and writing out the encoded binary string as raw data
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    IF pos + 57 - 1 > bfile_len
    THEN
    read_bytes := bfile_len - pos + 1;
    ELSE
    read_bytes := 57;
    END IF;
    DBMS_LOB.READ (bfile_handle, read_bytes, pos, DATA);
    UTL_SMTP.write_raw_data (conn, UTL_ENCODE.base64_encode (DATA));
    pos := pos + 57;
    IF pos > bfile_len
    THEN
    EXIT;
    END IF;
    -- If it is a text file, get the next line of text, append a
    -- carriage return / line feed to it, and write it out
    ELSE
    UTL_FILE.get_line (file_handle, line);
    UTL_SMTP.write_data (conn, line || crlf);
    END IF;
    END LOOP;
    -- Output any errors, except at end when no more data is found
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    my_code := SQLCODE;
    my_errm := SQLERRM;
    DBMS_OUTPUT.put_line ('Error code ' || my_code || ': ' || my_errm);
    END;
    -- Close the file (binary or text)
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    DBMS_LOB.CLOSE (bfile_handle);
    ELSE
    UTL_FILE.fclose (file_handle);
    END IF;
    IF directory_name = generated_name
    THEN
    EXECUTE IMMEDIATE 'drop directory ' || directory_name;
    END IF;
    END;
    BEGIN
    -- Load the three filenames and file (mime) types into an array for
    -- easier handling later
    file_array (1) := filename1;
    file_array (2) := filename2;
    file_array (3) := filename3;
    type_array (1) := filetype1;
    type_array (2) := filetype2;
    type_array (3) := filetype3;
    -- Open the SMTP connection and set the From and To e-mail addresses
    conn := UTL_SMTP.open_connection (smtp_host, smtp_port);
    UTL_SMTP.helo (conn, smtp_host);
    recipients := from_name;
    UTL_SMTP.mail (conn, get_address (recipients));
    recipients := to_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    recipients := cc_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    recipients := bcc_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    UTL_SMTP.open_data (conn);
    -- Build the start of the mail message
    mesg :=
    'Date: '
    || TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss')
    || crlf
    || 'From: '
    || from_name
    || crlf
    || 'Subject: '
    || subject
    || crlf
    || 'To: '
    || to_names
    || crlf;
    IF cc_names IS NOT NULL
    THEN
    mesg := mesg || 'Cc: ' || cc_names || crlf;
    END IF;
    IF bcc_names IS NOT NULL
    THEN
    mesg := mesg || 'Bcc: ' || bcc_names || crlf;
    END IF;
    mesg :=
    mesg
    || 'Mime-Version: 1.0'
    || crlf
    || 'Content-Type: multipart/mixed; boundary="'
    || boundary
    || '"'
    || crlf
    || crlf
    || 'This is a Mime message, which your current mail reader may not'
    || crlf
    || 'understand. Parts of the message will appear as text. If the remainder'
    || crlf
    || 'appears as random characters in the message body, instead of as'
    || crlf
    || 'attachments, then you''ll have to extract these parts and decode them'
    || crlf
    || 'manually.'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    -- Write the text message or message file, if any
    IF MESSAGE IS NOT NULL
    THEN
    mesg :=
    || boundary
    || crlf
    || 'Content-Type: text/plain; name="message.txt"; charset=US-ASCII'
    || crlf
    || 'Content-Disposition: inline; filename="message.txt"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    IF SUBSTR (MESSAGE, 1, 1) = '/'
    THEN
    split_path_name (MESSAGE, directory_path, file_name);
    append_file (directory_path, file_name, 'text', conn);
    UTL_SMTP.write_data (conn, crlf);
    ELSE
    UTL_SMTP.write_data (conn, MESSAGE || crlf);
    END IF;
    END IF;
    IF html_message IS NOT NULL
    THEN
    mesg :=
    || boundary
    || crlf
    || 'Content-Type: text/html; name="message.html"; charset=US-ASCII'
    || crlf
    || 'Content-Disposition: inline; filename="message.html"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    IF SUBSTR (html_message, 1, 1) = '/'
    THEN
    split_path_name (html_message, directory_path, file_name);
    append_file (directory_path, file_name, 'text', conn);
    UTL_SMTP.write_data (conn, crlf);
    ELSE
    UTL_SMTP.write_data (conn, html_message || crlf);
    END IF;
    END IF;
    -- Append the files
    FOR i IN 1 .. 3
    LOOP
    -- If the filename has been supplied ...
    IF file_array (i) IS NOT NULL
    THEN
    split_path_name (file_array (i), directory_path, file_name);
    -- Generate the MIME boundary line according to the file (mime) type
    -- specified.
    mesg := crlf || '--' || boundary || crlf;
    SELECT INSTR (file_name, '.')
    INTO l_length
    FROM DUAL;
    SELECT SUBSTR (file_name, 1, l_length - 1) || '.pdf'
    INTO l_sub
    FROM DUAL;
    IF SUBSTR (type_array (i), 1, 4) != 'text'
    THEN
    mesg :=
    mesg
    || 'Content-Type: '
    || type_array (i)
    || '; name="'
    || file_name
    || '"'
    || crlf
    || 'Content-Disposition: attachment; filename="'
    || file_name
    || '"'
    || crlf
    || 'Content-Transfer-Encoding: base64'
    || crlf
    || crlf;
    ELSE
    mesg :=
    mesg
    || 'Content-Type: application/octet-stream; name="'
    || file_name
    || '"'
    || crlf
    || 'Content-Disposition: attachment; filename="'
    || file_name
    || '"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    END IF;
    UTL_SMTP.write_data (conn, mesg);
    -- Append the file contents to the end of the message
    append_file (directory_path, file_name, type_array (i), conn);
    UTL_SMTP.write_data (conn, crlf);
    END IF;
    END LOOP;
    -- Append the final boundary line
    mesg := crlf || '--' || boundary || '--' || crlf;
    UTL_SMTP.write_data (conn, mesg);
    -- Close the SMTP connection
    UTL_SMTP.close_data (conn);
    UTL_SMTP.quit (conn);
    END;
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • How can i secure email with attachments using coldfusion

    Hi,
    I need to send emails with attachments containg word, excel or PDF documents using cfmail. However this email needs to be really secure. How is the best way to secure the entire email with its attachments.
    Any ideas appreciated
    Thanks
    Zubair

    Hi ,
    I hope the following will help you..., using the UTL_SMTP db package.
    DECLARE
    c UTL_SMTP.CONNECTION;
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
    BEGIN
    UTL_SMTP.WRITE_DATA(c, name || ': ' || header || UTL_TCP.CRLF);
    END;
    BEGIN
    -- Open connection to SMTP gateway
    c := UTL_SMTP.OPEN_CONNECTION('smtp.server.acme.com');
    UTL_SMTP.HELO(c, 'acme.com');
    UTL_SMTP.MAIL(c, '[email protected]');
    UTL_SMTP.RCPT(c, '[email protected]');
    UTL_SMTP.OPEN_DATA(c);
    send_header('From', '"Oracle Admin" ');
    send_header('To', '"Bob Smith" ');
    send_header('Subject', 'Automated Database Email');
    UTL_SMTP.WRITE_DATA(c, utl_tcp.CRLF || 'This is an automated email from the Oracle database.');
    UTL_SMTP.WRITE_DATA(c, utl_tcp.CRLF || 'The database is working for you!');
    UTL_SMTP.CLOSE_DATA(c);
    UTL_SMTP.QUIT(c);
    END;
    Simon

  • I want to view email file attachments in the 6.0 browzer, how?

    Operating System XP SP2, Firefox 6.0, Email Outlook Express.
    I am emailed video files as attachments in Quick Time Player formats .MOV and M4V. I am unable to view the files from the Browzer. I have to save the files and access to access them in VLC Media Player. I want to be able to click on the attachments and view within Firefox as in prior versions.
    I see no one else has asked this question, but there are a multitude of complaints on line.
    Edward Pinhey

    You can't. Not in landscape. There is no way to hide or remove it.

  • Using PI 7.1 to transfer file attachments using MTOM standard

    Hello All,
    We have a scenario using PI 7.1 and we are required that PI calls a synchronous backend service and the backend service returns an attachement using MTOM format.
    1) Can this be handled using PI ?
    2) Any file size restrictions doing so using PI.
    3) Any configuration setting which can be used to achieve the same.
    Thanks.
    Kiran

    hi,
    this should be possible with 7.1 as per:
    http://help.sap.com/saphelp_nwpi71/helpdata/en/76/fc9c3d9a864aef8139d70759a499fc/frameset.htm
    please check out also this page for config options for MTOM
    part : Applying MTOM in the Web Services Runtime
    Regards,
    Michal Krawczyk

  • Sending emails with attachments  , using Automator

    I am new to Automator , which seems an amazing programme .
    I have set up a workflow so I can send images embedded into emails and send .
    However I am finding the apple mail takes ages to send emails out .
    Is there a way I could send them via another mail programme ?.
    Any genius out there ¿ .
    thank you

    Which antivirus software do you run on your computer? Are there any errors posting?  Have you shut off any email firewalls temporarily to attempt to isolate your issue?  Do you have outlook 2003 on more than 1 pc in your home?  Have your tried to attach a small text file and send it to see if that goes thru successfully?
    Joe D
    Verizon Telecom
    Fiber Solution Center
    Notice: Content posted by Verizon employees is meant to be informational and does not supercede or change the Verizon Forums User Guidelines or Terms or Service, or your Customer Agreement Terms and Conditions or Plan.Follow us on Twitter™!

  • Email file attachments in SAP

    Hello,
    Is there any size limitation for the attachments in mail send option?
    If yes where can we check the defined limit.
    In my case when attached file contains more than 1000 records, it does not send the data in mail.
    Is there any parameter to pass in such case?
    <removed by moderator>
    Thanks and Regards
    Nishad
    Edited by: Thomas Zloch on Mar 29, 2011 4:12 PM - priority reduced

    Hi  ,
    There may be some limitation  for SAp mail size  attachment  but  Please check with your Administrator Team  who handles  Mail server . Because Company Generally has Policy for Mail Attahcment Size   upto say 5 MB or 10 MB  .
    Regards
    Deepak.

  • Sending emails with attachments through outlook 2003

    Hello,
    I have recently switch from cablevison to Fios. With Cablevison, I never had a problem with email. However, now I am having problems sending emails with attachments using outlook 2003. I have called Verizon and we troubleshooted the problem and they feel this is a Microsoft problem.
    I can send email's without attachments through outlook and verizon.net, but I can't send emails with attachments through outlook, I can send them though verizon.net.  All my settings are correct for sending and receiving email.
    I called Microsoft and they say it a Verizon problem...
    HELP, does anyone have a solution?????
    Thanks
    Len628

    Which antivirus software do you run on your computer? Are there any errors posting?  Have you shut off any email firewalls temporarily to attempt to isolate your issue?  Do you have outlook 2003 on more than 1 pc in your home?  Have your tried to attach a small text file and send it to see if that goes thru successfully?
    Joe D
    Verizon Telecom
    Fiber Solution Center
    Notice: Content posted by Verizon employees is meant to be informational and does not supercede or change the Verizon Forums User Guidelines or Terms or Service, or your Customer Agreement Terms and Conditions or Plan.Follow us on Twitter™!

  • Export file Attachments in Siebel

    hi ,
    we have a requirement to export siebel attachment from Siebel eclinical application. The entity relation is between activity and attachments.
    When i am trying to export the files attachments using the following IFB code
    [Siebel Interface Manager]
         USER NAME = "sadmin"
         PASSWORD = "****"
         PROCESS = "EXPORTATTACHMENTS"
    [EXPORTATTACHMENTS]
         TYPE = EXPORT
         TABLE = EIM_ACT_DTL
         BATCH = 2
         ATTACHMENT DIRECTORY = "f:\sia81\CTMS\siebsrvr\OUTPUT"
         EXPORT ALL ROWS = FALSE
         EXPORT MATCHES     = S_ACTIVITY_ATT,( FILE_NAME LIKE "MarcRendell-PS%")
    When runnign this ifb following is the observation
    1) the process is extracting all the reocrds activity table to EIM tables and seems like EXPORT MATCHES condition is kinda ignored as there were less numbers of recprds which were expedted.
    2) the files are not getting exported to the location ( also tried with SiebFS)
    Could you please help me with your inputs which will help me to solve this issue.
    Warm Regards
    Ashutosh

    hi
    when i used this IFB without quotes still i could not manange to get the files in the OUTPUT folder.
    [Siebel Interface Manager]
         USER NAME = "sadmin"
         PASSWORD = "sadmin"
         PROCESS = "EXPORTATTACHMENTS"
    [EXPORTATTACHMENTS]
         TYPE = EXPORT
         ATTACHMENT DIRECTORY = G:\sia81\CTMSTG\siebsrvr\OUTPUT
         BATCH = 2
         TABLE = EIM_ACT_DTL
         EXPORT MATCHES     = S_EVT_ACT,(ACTIVITY_UID LIKE "1-36RUP%")
         ONLY BASE TABLES = S_EVT_ACT,S_EVT_ACT_X,S_ACTIVITY_ATT
    I could see the following error in the log file.
    rem Unzip G:\sia81\CTMSTG\siebsrvr\OUTPUT\XXXXX_104 - Dr XXX - XXX FUL -
    EIMSQL     EIMSQLSubEvent     4     00000fee4f2f03c0:0     2012-02-08 05:39:11     rem 13 Oct 2009.pdf failed.
    please suggest probable cause.
    Thanks
    Ashutosh

  • Fetching email with attachments in Tomcat

    I'm trying to process emails with attachments using following code and it works fine in standalone java application, but when I run this code on Tomcat it treates all messages as not multipart. Class of all contents got from messages is SharedByteArrayInputStream.
    I'm using jdk1.6.0_27 and javamail1_4_5
    I put mail.jar in WEB-INF/lib of my war.
    Can anyone help my how to deal with this? What's wrong?
    package test;
    import java.util.Arrays;
    import java.util.List;
    import java.util.Properties;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Session;
    import javax.mail.Store;
    public class Main {
    private static Store store;
    private static Folder folder;
    * @param args
    * @throws Exception
    public static void main(String[] args) throws Exception {
    try {
    List<Message> messages = getMessages("...", "...", "...");
    for (Message mess : messages) {
    System.out.println(mess.getSentDate());
    Object content = mess.getContent();
    if (content instanceof Multipart) {
    System.out.println("miltipart");
    } else {
    System.out.println("plain");
    } finally {
    close();
    public static List<Message> getMessages(String host, String userName, String password) throws Exception {
    if (store != null || folder != null) {
    throw new IllegalStateException("There are open and closed messages exist");
    // create empty properties
    Properties props = new Properties();
    // get session
    Session session = Session.getDefaultInstance(props, null);
    try {
    // get the store
    store = session.getStore("pop3");
    store.connect(host, userName, password);
    // get folder
    folder = store.getFolder("INBOX");
    folder.open(Folder.READ_ONLY);
    // get directory
    return Arrays.asList(folder.getMessages());
    } catch (MessagingException e) {
    throw new Exception("Exception while mail receiving ", e);
    public static void close() throws MessagingException {
    // close connection
    if (folder != null) {
    folder.close(false);
    if (store != null) {
    store.close();
    folder = null;
    store = null;
    }

    But I found another interesting issue.
    When I run my application everything works fine on first iteration. According to my code I get default instance of Session, get Store, get Folder and at last getMessages. After processing messages I close folder and store.
    But if I don't restart my application and try to get messages again all of the SAME messages became plain (SharedByteArrayInputStream) again (as it was earlier).
    If I restart my application first iteration works fine and others fails.
    In both iterations used the same instance of class where I put Thread.currentThread().setContextClassLoader(BaseEmailService.class.getClassLoader());
    What I must reinitialize to make it works on each iteration?

  • How can I email using UTL_SMTP with a csv file as an attachment?

    Dear All,
    It would be great if someone could help me. I am trying to use UTL_SMTP to email with a csv file as attachment. I do get an email with a message but no attachment arrives with it.
    In fact the code used for attaching the csv file gets appended in the message body in the email.
    CREATE OR REPLACE PROCEDURE test_mail
    AS
    SENDER constant VARCHAR2(80) := '[email protected]';
    MAILHOST constant VARCHAR2(80) := 'mailhost.xxxx.ac.uk';
    mail_conn utl_smtp.connection;
    lv_rcpt VARCHAR2(80);
    lv_mesg VARCHAR2(9900);
    lv_subject VARCHAR2(80) := 'First Test Mail';
    lv_brk VARCHAR2(2) := CHR(13)||CHR(10);
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25) ;
    utl_smtp.helo(mail_conn, MAILHOST) ;
    dbms_output.put_line('Sending Email to : ' ||lv_brk||'Suhas Mitra' ) ;
    lv_mesg := 'Date: '||TO_CHAR(sysdate,'dd Mon yy hh24:mi:ss')||lv_brk||
    'From: <'||SENDER||'>'||lv_brk||
    'Subject: '||lv_subject||lv_brk||
    'To: '||'[email protected]'||lv_brk||
    'MIME-Version: 1.0'||lv_brk||
    'Content-type:text/html;charset=iso-8859-1'||lv_brk||
    ' boundary="-----SECBOUND"'||
    ''||lv_brk||
    '-------SECBOUND'||
    'Some Message'
              || lv_brk ||
    '-------SECBOUND'||
              'Content-Type: text/plain;'|| lv_brk ||
              ' name="xxxx.csv"'|| lv_brk ||
              'Content-Transfer_Encoding: 8bit'|| lv_brk ||
              'Content-Disposition: attachment;'|| lv_brk ||
              ' filename="xxxx.csv"'|| lv_brk ||
              lv_brk ||
    'CSV,file,attachement'|| lv_brk ||     -- Content of attachment
    lv_brk||
    '-------SECBOUND' ;
    dbms_output.put_line('lv_mesg : ' || lv_mesg) ;
    utl_smtp.mail(mail_conn, SENDER) ;
    lv_rcpt := '[email protected]';
    utl_smtp.rcpt(mail_conn, lv_rcpt) ;
    utl_smtp.data(mail_conn, lv_mesg) ;
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    NULL ;
    WHEN OTHERS THEN
    dbms_output.put_line('Error Code : ' || SQLCODE) ;
    dbms_output.put_line('Error Message : ' || SQLERRM) ;
    utl_smtp.quit(mail_conn) ;
    END;

    LKBrwn_DBA wrote:
    Use UTL_MAIL instead.That package is an utter disappointment - and an excellent example IMO of how not to design an application programming interface. Even the source code is shoddy.. I mean, having to resort to a GOTO statement....!!?? The person(s) who wrote that package are sorely lacking in even the most basic of programming skills if structured programming is ignored and a spaghetti command used instead.
    No wonder the public interface of that code is equally shabby and thoughtless... The mail demo code posted by Oracle was better written than this "+package+" they now have bundled as the official Mail API.
    I dunno.. if I was in product management there would have been hell to pay over pushing cr@p like that to customers.

  • I'm using yahoo email on firefox but cannot download or save doc file attachments

    Emails that I have received on my yahoo account contain attachments, saved as word documents or powerpoint or pdf files. Today, when I tried to download these files, the daownloading software could not recognise the file format in any of the files (I tried with twenty different files), and therefore could not download or save the files. The pop up window simply states "Resolving...." and does not change at all.
    Please assist me to download file attachments on emails that come through yahoo, when I use Firefox as my browser.

    Hi there,
    Please take a look at this article ([[Managing file types]]). Let us know if it worked!
    Regards,
    Ziggy

Maybe you are looking for