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

Similar Messages

  • How can i use UTL_SMTP package in oracle 8i 1.5

    i want to use UTL_SMTP package to send mail but i have installed oracle 8i 1.5
    i know that UTL_SMTP package come with oracle 8i 1.6
    i will send mail from eudora
    thanks

    Hi,
    Run d:/oracle/ora81/rdbms/admin/utlsmtp.sql as SYS user. It create the package UTL_SMTP.
    Hope this helps.
    rukmini

  • Mail using utl_smtp package

    can we send attachment with mail by using utl_smtp package.
    i am using form6i with database 9i in 2 tier environment

    Hi,
    read the following:
    Can 9i email utl_smtp send attachments? ,
    Re: sending attchements with utl_smtp
    As an alternative there is also the UTL_MAIL built-in package as well...
    Regards,
    Simon

  • HT1430 I can get emails on my IPad but can't send them.Help,please.Thanks.

    I can get emails on my IPad but can't send them.Help,please.

    Did you check the outgoing mail server setting? Make sure that your username and password are in there.
    Settings>Mail, Contacts, Calendars>Your email account>Account>Outgoing mail server - tap the server name next to SMTP and check in the primary server and make sure your username and password are entered and correct - even if it says that the password is optional.

  • Attaching files in a mail using utl_smtp package

    I am using a batch file to automate
    execution of a sql script. The script would generate a .csv file and I now need to mail this file to a user at regular intervals.
    Please suggest a good tool to attach the file and send a mail. I tried utl_smtp package, but its not possible to attach a file and also, the text size should not be more than 1000 characters.
    Thank you,

    http://www.softtreetech.com/
    has a package DB mail.
    Check this out.

  • Using SRW package to send a report via email

    Hi,
    Please can someone please help me resolve this issue I have been facing in using the srw package
    I have configured a report server and was trying to use the srw package to send a report out to our customers when there is an update on a particular table.
    I have succesfully use this same procedure to generate the same report to an output file and it was ok but anytime I try to generate the report as a mail and send to a DESNAME, i get mail server unavailable.
    Below is the procedure i try to execute:
    procedure testrep(new_name in varchar2) as
    myPlist SRW_PARAMLIST;
    myIdent SRW.Job_Ident;
    BEGIN
         myPlist := SRW_PARAMLIST(SRW_PARAMETER('',''));
    srw.add_parameter(myPlist,'GATEWAY','http://technorth4:7780/reports/rwservlet');
    srw.add_parameter(myPlist,'SERVER','rep_technorth4');
    srw.add_parameter(myPlist,'REPORT','c:\gens\name.rdf');
    srw.add_parameter(myPlist,'USERID','gens/[email protected]');
    srw.add_parameter(myPlist,'AUTHID','orcladmin/password1@orcl');
    srw.add_parameter(myPlist,'DESTYPE','MAIL');
    srw.add_parameter(myPlist,'DESFORMAT','PDF');
    srw.add_parameter(myPlist,'FROM','[email protected]');
    srw.add_parameter(myPlist,'DESNAME','[email protected]');
    srw.add_parameter(myPlist,'T1',new_name);
    myIdent := srw.run_report(myPlist);
    END;
    when i now start debugging i got this error:
    SQL> set serveroutput on
    SQL> exec srw.start_debugging
    * WELCOME TO EVENT-BASED-REPORTING API *
    * API-Version : 9i *
    * (C) Oracle Corporation, 2000 - 2002 *
    * Debugging turned ON **************************
    PL/SQL procedure successfully completed.
    SQL> exec testrep('TOPE');
    *** Length of Paramlist : 1
    OK : Parameter added : GATEWAY=http://technorth4:7780/reports/rwservlet
    *** Length of Paramlist : 2
    OK : Parameter added : SERVER=rep_technorth4
    *** Length of Paramlist : 3
    OK : Parameter added : REPORT=c:\gens\name.rdf
    *** Length of Paramlist : 4
    OK : Parameter added : USERID=gens/[email protected]
    *** Length of Paramlist : 5
    OK : Parameter added : AUTHID=orcladmin/password1@orcl
    *** Length of Paramlist : 6
    OK : Parameter added : DESTYPE=MAIL
    *** Length of Paramlist : 7
    OK : Parameter added : DESFORMAT=PDF
    *** Length of Paramlist : 8
    OK : Parameter added : [email protected]
    *** Length of Paramlist : 9
    OK : Parameter added : [email protected]
    *** Length of Paramlist : 10
    OK : Parameter added : T1=TOPE
    Starting run_report: building url
    *** Building URL (RUN_REPORT)
    OK : URL built :
    http://technorth4:7780/reports/rwservlet?SERVER=rep%5Ftechnorth4&REPORT=c%3A%5Cg
    ens%5Cname%2Erdf&USERID=gens%2Fgens%40technorth%2Eworld&AUTHID=orcladmin%2Fpassw
    ord1%40orcl&DESTYPE=MAIL&DESFORMAT=PDF&FROM=tope%5Folowosale%40gtbplc%2Ecom&D
    *** Submitting HTTP Request
    *** using URL
    :http://technorth4:7780/reports/rwservlet?SERVER=rep%5Ftechnorth4&REPORT=c%3A%5C
    gens%5Cname%2Erdf&USERID=gens%2Fgens%40technorth%2Eworld&AUTHID=orcladmin%2Fpass
    word1%40orcl&DESTYPE=MAIL&DESFORMAT=PDF&FROM=tope%5Folowosale%40gtbplc%2Ecom&DES
    OK : Request submitted - Return stream : <?xml version = '1.0' encoding =
    'ISO-8859-1' standalone = 'yes'?>
    <serverQueues>
    <error code="50138"
    component="REP" message="Mail server is not available"/>
    </serverQueues>
    OK : Request submitted - Length of stream : 182
    *** XML-Parsed - Following Structure discovered :
    *** Checking elements!
    serverQueues ()
    *** Checking attributes!
    error
    *** Checking attributes!
    __code = 50138
    __component = REP
    __message = Mail server is not available
    *** Finished Parsing XML
    Getting value for element: job
    Getting value for element: error
    *** Requesting value for Attribute error.component [REP]
    Getting value for element: error
    *** Requesting value for Attribute error.code [50138]
    Getting value for element: error
    *** Requesting value for Attribute error.message [Mail server is not available]
    REP-50138:Mail server is not available
    BEGIN testrep('TOPE'); END;
    ERROR at line 1:
    ORA-20999:
    ORA-06512: at "GENS.SRW", line 284
    ORA-06512: at "GENS.SRW", line 815
    ORA-06512: at "GENS.TESTREP", line 17
    ORA-06512: at line 1
    Please can someone help me with this. I can connect to the mail server using the telnet mailservername port,i get a 220 message with ***** .
    I have updated d report configuration file with the mailserver name, and d proxyinfo.xml too.I put it to bypass proxy for d mail server address and also inlclude the proxy ip and port.
    Kindly assist me as it is urgent.
    Thank you.

    You are in the wrong forum. Please try the Reports.<br><br>
    Regards,
    Rob.

  • I have had an iphone 4s for over a year and have had no problems sending emails in hotmail but now I cannot send them. What do I need to do!

    I am having problems sending emails in Hotmail on my 4s. It has worked fine for a year but now I can't send them.

    It will be your SMTP settings see this doc to troubleshoot
    http://www.apple.com/support/iphone/mail/
    often adding the password and user name for the carrier helps ,despite it saying not needed !

  • 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

  • Receiver email encoding problem using mail package

    Hi to all.
    I'm facing a email problem. My company email server is workig fine with emails subject but customers email server is making some strange changes when i use special characters such as 'á' or spanish letter 'n with a tail on the top'.
    I set the field 'Content_Type' of the email to 'text/plain; charset=ISO-8859-1' but isn't working. If i remove those special chars, the subject is OK.
    I also tried to add content conversion in the receiver email adapter in module tab but with no possitive results.
    I'm using SAP PI 7.0 sp14.
    Any idea of what is happening?
    Kind regards,
    Inigo.

    If you want to use non-ascii characters in email subject, then you have to apply a special notation for this, like follows:
    =?utf-8?Q?Auftragsbest=C3=A4tigung?= 
    This is email standard. So I recommend not use non-ascii characters in email subject.
    Regards
    Stefan

  • I can't receive email in Mac Mail but I can send them

    I use two email programmes on my Mac Mini - Thunderbird and Mac Mail. I can receive and send emails on Thudnerbird and I can send emails on Mac Mail but I can't receive the. Next to the mailbox is a squiggly line like a wave which I presume is the promblem but I don't know what that problem is.
    I don't have this problem on my MacBook Air.
    The Mac Mini is using Mac OS X Lion 10.7.5.
    Thanks
    roger

    If an option exists on networksolutions to allow you to log in to your email via your web browser then access your mail via webmail then try deleting the offending message that way.
    Chris

  • My gmail started to put outgoing emails in the outgoing box and not send them. what do i do?

    The last sent email from my gmail account was on Jan 6. Since then every email I have sent has been put into my outgoing folder and not sent.
    How do I fix this?

    Troubleshooting Apple Mail
    What does Mail/Window/Connection Doctor Show? If the server is red, select it and look at the Show Details box.
    Troubleshooting sending and receiving email messages
    Troubleshooting sending email messages
    SMTP servers keep going offline

  • Sending formatted email

    Hi,
    I am using oracle 10.2.0.4 database
    Is there any one who can guide me that how to send a formatted email from oracle using UTL_SMTP package. For example, if i query dba_data_files view as follows
    select file_name,bytes,autoextensible from dba_data_files;
    Query returnts me a number of rows and i want to send this result through email same in the table format in which the query returns the result.
    Thanks in advance.

    Salman Qureshi wrote:
    Is there any one who can guide me that how to send a formatted email from oracle using UTL_SMTP package. For example, if i query dba_data_files view as follows
    select file_name,bytes,autoextensible from dba_data_files;You need to format a HTML mail - and format the contents of that query as a HTML table.
    Do you know HTML? If not, use a search engine and research how to construct a HTML table with rows and columns.
    In PL/SQL, you can use UTL_MAIL to send the mail. The body of the mail (e.g. varchar2(32767) variable) will contain the HTML table. The MIME type of the mail needs to be "+text/html+" in order to inform the mail reader to render the body of that e-mail using a HTML rendering engine.
    The PL/SQL code will look something as follows:
      <creating the HTML table in a varchar2 variable called mailBody>
      -- now send that as a HTML e-mail
      UTL_MAIL.Send(
        sender => '[email protected]',
        recipients => '[email protected]',
        subject => 'SQL Table Results',
        message => mailBody,
        mime_type => 'text/html'
    ...

  • Sending  mail data in tabular format using UTL_SMTP.

    I am using UTL_SMTP package for sending the mails after the job is running . Now there is requirement to send the same mail in Tabular Format . Is it possible to do the same . I am sending the mails using the secure server of my company.

    sunnymoon wrote:
    i need to send the mail using UTL_SMTP in which the mail body will be displayed in tabular format .You need to format a HTML Mime (Multipurpose Internet Mail Extensions) body as the e-mail. And use the HTML table element to format data into a tabular format.
    This has NOTHING to do with UTL_SMTP. SMTP is a transport protocol. It does not create Mime bodies for you. It does not do Mime formatting or parsing or whatever. It simply moves a payload from the client to the server for delivery as an e-mail.
    So your code needs to create that payload. You need to format a proper Mime body in your code. Not UTL_SMTP. Not PL/SQL.

  • Send mail using utl_smtp

    Hi Experts,
    I am using utl_smtp package to send a mail from oracle procedure. My procedure is
    CREATE OR REPLACE PROCEDURE TEST_UTLFILE_EMAIL (pSender VARCHAR2, pRecipient VARCHAR2, pSubject VARCHAR2, pMessage VARCHAR2) IS
    mailhost CONSTANT VARCHAR2(30) := 'host';
    crlf CONSTANT VARCHAR2(2):= CHR(13) || CHR(10);
    mesg VARCHAR2(1000);
    mail_conn utl_smtp.connection;
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    mesg := 'Date: ' ||
    TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf ||
    'From: <'|| pSender ||'>' || crlf ||
    'Subject: '|| pSubject || crlf ||
    'To: '||pRecipient || crlf || '' || crlf || pMessage;
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, pSender);
    utl_smtp.rcpt(mail_conn, pRecipient);
    utl_smtp.data(mail_conn, mesg);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN INVALID_OPERATION THEN
    NULL;
    WHEN TRANSIENT_ERROR THEN
    NULL;
    WHEN PERMANENT_ERROR THEN
    NULL;
    WHEN OTHERS THEN
    NULL;
    END TEST_UTLFILE_EMAIL;
    when i compiled this procedure, this is giving following error message.
    LINE/COL ERROR
    0/0 PL/SQL: Compilation unit analysis terminated
    19/8 PLS-00201: identifier 'INVALID_OPERATION' must be declared
    Please help me out in solving this.
    Regards,
    Chandu

    Define the exception's like
    CREATE OR REPLACE PROCEDURE TEST_UTLFILE_EMAIL(pSender VARCHAR2,
    pRecipient VARCHAR2,
    pSubject VARCHAR2,
    pMessage VARCHAR2) IS
    mailhost CONSTANT VARCHAR2(30) := 'host';
    crlf CONSTANT VARCHAR2(2) := CHR(13) || CHR(10);
    mesg VARCHAR2(1000);
    mail_conn utl_smtp.connection;
    invalid_operation EXCEPTION; -- Operation is invalid
    transient_error EXCEPTION; -- Transient server error in 400 range
    permanent_error EXCEPTION; -- Permanent server error in 500 range
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    mesg := 'Date: ' || TO_CHAR(SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf ||
    'From: <' || pSender || '>' || crlf || 'Subject: ' ||
    pSubject || crlf || 'To: ' || pRecipient || crlf || '' || crlf ||
    pMessage;
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, pSender);
    utl_smtp.rcpt(mail_conn, pRecipient);
    utl_smtp.data(mail_conn, mesg);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN INVALID_OPERATION THEN
    NULL;
    WHEN TRANSIENT_ERROR THEN
    NULL;
    WHEN PERMANENT_ERROR THEN
    NULL;
    WHEN OTHERS THEN
    NULL;
    END TEST_UTLFILE_EMAIL;

  • Sending text Attachment using UTL_SMTP

    Hi,
    I am using UTL_SMTP package for sending a text file thru' a mail.
    Our database is in a unix machine. My file is created in a folder oracle/DEV/CCare/Data which is in the root directory.
    In the URL argument of the procedure,which is a varchar2 type, i am passing the path as 'oracle/DEV/CCare/Data'. Also i have tried passing '/oracle/DEV/CCare/Data' like this. But none of them is working could anybody suggest way of passing the URL.
    The package arguments look like below.
    oks_mail.send_attachment(sender => l_fromemailid,
    recipient_tbl => to_mail_tbl,
    subject => 'Progress report for CCC Feed',
    mail_text => l_mailtext1,
    url => '//10.10.81.3/oracle/DEV/CCare/Data',
    file_name => filename);

    Use
    FILE_ARRAY(1) := file_name;
    RETURN_DESC1 := '10 - E: THERE WAS AN ERROR IN OPENING CONNECTION. ';
    CONN:= UTL_SMTP.OPEN_CONNECTION( L_SMTP_SERVER, L_SMTP_SERVER_PORT ); /** OPEN CONNECTION ON THE SERVER **/
    UTL_SMTP.HELO( CONN, L_SMTP_SERVER ); /** DO THE INITIAL HAND SHAKE **/
    UTL_SMTP.MAIL( CONN, L_SENDER_NAME );
    RETURN_DESC1 := '20 - E: THERE WAS AN ERROR IN CREATING RECEIPIENTS. ';
    UTL_SMTP.RCPT( CONN, '[email protected]');
    UTL_SMTP.OPEN_DATA ( CONN );
    --Send_header('Subject', 'File - ');
    /*** GENERATE THE MIME HEADER ***/
    RETURN_DESC1 := '30 - E: THERE WAS AN ERROR IN GENERATING MIME HEADER. ';
    L_MESG:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' )|| CRLF ||
    'From: ' || L_SENDER_NAME || CRLF ||
    'Subject: ' || file_name || CRLF ||
    'To: ' || L_MSG_TO || CRLF ||
    'Mime-Version: 1.0' || CRLF ||
    'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"'|| 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 ||
    '--DMW.Boundary.605592468' || 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 || CRLF || CRLF || CRLF ;*/
    L_MESG_LEN := LENGTH(L_MESG);
    IF L_MESG_LEN > MAX_SIZE THEN
    MESG_LENGTH_EXCEEDED := TRUE;
    END IF;
    RETURN_DESC1 := '40 - E: THERE WAS AN ERROR IN WRITING MESSAGE TO CONNECTION. ';
    UTL_SMTP.WRITE_DATA ( CONN, L_MESG );
    /*** START ATTACHING THE FILES ***/
    FOR I IN 1..1 LOOP
    EXIT WHEN MESG_LENGTH_EXCEEDED;
    IF FILE_ARRAY(I) IS NOT NULL THEN
    BEGIN
    L_SLASH_POS := INSTR(FILE_ARRAY(I), '/', -1 );
    IF L_SLASH_POS = 0 THEN
    L_SLASH_POS := INSTR(FILE_ARRAY(I), '\', -1 );
    END IF;
    L_DIRECTORY_NAME := SUBSTR(FILE_ARRAY(I), 1, L_SLASH_POS - 1 );
    L_FILE_NAME := SUBSTR(FILE_ARRAY(I), L_SLASH_POS + 1 );
    RETURN_DESC1 := '50 - E: THERE WAS AN ERROR IN OPENING FILE. ';
    L_FILE_HANDLE := UTL_FILE.FOPEN(L_DIRECTORY_NAME, L_FILE_NAME, 'R' );
    L_MESG := CRLF || '--DMW.Boundary.605592468' || CRLF ||
    'Content-Type: application/octet-stream; name="' || L_FILE_NAME || '"' || CRLF ||
    'Content-Disposition: attachment; filename="' || L_FILE_NAME || '"' || CRLF ||
    'Content-Transfer-Encoding: 7bit' || CRLF || CRLF ;
    L_MESG_LEN := L_MESG_LEN + LENGTH(L_MESG);
    UTL_SMTP.WRITE_DATA ( CONN, L_MESG );
    LOOP
    RETURN_DESC1 := '60 - E: THERE WAS AN ERROR IN READING FILE. ';
    UTL_FILE.GET_LINE(L_FILE_HANDLE, L_LINE);
    IF L_MESG_LEN + LENGTH(L_LINE) > MAX_SIZE THEN
    L_MESG := '*** truncated ***' || CRLF;
    UTL_SMTP.WRITE_DATA ( CONN, L_MESG );
    MESG_LENGTH_EXCEEDED := TRUE;
    EXIT;
    END IF;
    L_MESG := L_LINE || CRLF;
    UTL_SMTP.WRITE_DATA ( CONN, L_MESG );
    L_MESG_LEN := L_MESG_LEN + LENGTH(L_MESG);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    out_errcode:=-500;
    WHEN UTL_FILE.INVALID_PATH THEN
                        RAISE ABORT_PROGRAM;
    WHEN OTHERS THEN
    RAISE ABORT_PROGRAM;
    END;
    L_MESG := CRLF;
    UTL_SMTP.WRITE_DATA ( CONN, L_MESG );
    UTL_FILE.FCLOSE(L_FILE_HANDLE);
    END IF;
    END LOOP;
    RETURN_DESC1 := '70 - E: THERE WAS AN ERROR IN CLOSING MIME BOUNDARY. ';
    L_MESG := CRLF || '--DMW.Boundary.605592468--' || CRLF;
    UTL_SMTP.WRITE_DATA ( CONN, L_MESG );
    UTL_SMTP.CLOSE_DATA( CONN );
    UTL_SMTP.QUIT( CONN );

Maybe you are looking for

  • Acrobat XI Pro "Not Responding

    I recently updated to Windows 8 Professional and Acrobat worked like a charm for 3 days with instantaneous reponse. Now progressively I am back to the old problem that I had under Windows 7 and with Acrobat X and 9 - Whenever I open a new PDF it take

  • How to print all the same color events together?

    I am wanting to print off a chore schedule and have all of the blue tasks print off together, all of the green tasks printed together, ectra. It all looks good on the screen with all like colored events grouped together, but when I print it off the e

  • Error message when downloading software

    I just purchased an iPod nano and tried to install the software but the following error came up and won't let the download complete: 1155: FileD:\INSTMSIA.EXE not found. Does anyone know what is the problem, thanks!

  • Safari 6 Continuously Crashing

    After upgrading to Mountain Lion, Safari 6 is extremly unstable. It crashes often and once it crashes it will crash everytime you try to reopen the app. The only solution seems to be to switch to another browser for a while and after a while Safari i

  • New iMac Mini Display Port

    I can NOT believe it...the input dimensions for the mini display port are smaller on the new iMac than the previous iMac! So now I can't go dual screens until I buy another connector! That *****...why wouldn't accessories remain the same....just stup