Sending Unicode HTML email from Oracle

Dear All,
How we can send the HTML email from Oracle in Unicode format (I am using Arabic Language, to be specific). So far I have tried the following solutions (using utl_smpt) without any success (either i see junk characters in the email or see question marks). Would you please help me in solving this?
Options Tried*
Option 1
SQL> ed
Wrote file afiedt.buf
  1  CREATE OR REPLACE PROCEDURE p_send_mail_test (
  2  sender IN VARCHAR2,
  3  recipient IN VARCHAR2,
  4  subj IN VARCHAR2,
  5  message IN VARCHAR2)
  6  IS
  7  mailhost VARCHAR2(30) := '<smtp Server>';
  8  c utl_smtp.connection;
  9  PROCEDURE send_header( name IN VARCHAR2, header IN VARCHAR2) AS
10  BEGIN
11  utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);
12  END;
13  BEGIN
14  c := utl_smtp.open_connection(mailhost,25);
15  utl_smtp.helo(c, mailhost);
16  utl_smtp.mail(c, sender);
17  utl_smtp.rcpt(c, recipient);
18  utl_smtp.open_data(c);
19  send_header('From', sender);
20  send_header('To', recipient);
21  -- If you need to send mail to more than one receipient, uncomment the
22  -- following line(s) as appropriate. Please don't forget the ","
23  -- in the "To" line before the next receipient's email id. You can't
24  -- use a comma separated list in the receipient parameter.
25  -- For variable number of "To"'s and "Cc"'s have multiple calls to
26  -- "send_header" function inside a cursor for loop.
27  -- Similar comments apply for "Cc" too.
28  -- send_header('To', ',<email@domain>');
29   send_header('Cc', ',<email@domain>');
30  send_header('Subject', subj);
31  utl_smtp.write_data(c, utl_tcp.CRLF || message);
32  utl_smtp.close_data(c);
33  utl_smtp.quit(c);
34  EXCEPTION
35  WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
36  utl_smtp.quit(c);
37  raise_application_error(-20000,
38  'Failed to send mail due to the following error: ' || sqlerrm);
39* END;
SQL>
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
  1  declare
  2   email_text varchar2(2000);
  3   contract_end_date_v date := sysdate;
  4   name_v varchar2(200) := 'Riaz';
  5   begin
  6    email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||'  المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى  <br/>.ولكم جزيل الشكر والتقدير  </font></div>';
  7    p_send_mail_test('<email@domain>','<email@domain>','Hello',email_text);
  8*  end;
SQL> /
PL/SQL procedure successfully completed.
Result_
<div align="right"><font size="4"><b>????? Riaz ???????</b>
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
.???? ???? ????? ???????? </font></div>
[Question marks along with all tags; this OTN page is converting that to HTML output]
Option2
SQL> ed
Wrote file afiedt.buf
  1  create or replace procedure html_email(
  2      p_to            in varchar2,
  3      p_from          in varchar2,
  4      p_subject       in varchar2,
  5      p_text          in varchar2 default null,
  6      p_html          in varchar2 default null
  7  )
  8  is
  9      l_boundary      varchar2(255) default 'a1b2c3d4e3f2g1';
10      l_connection    utl_smtp.connection;
11      l_body_html     clob := empty_clob;  --This LOB will be the email message
12      l_offset        number;
13      l_ammount       number;
14      l_temp          varchar2(32767) default null;
15      l_smtp_hostname varchar2(50) := '<smtp Server>';
16  begin
17      l_connection := utl_smtp.open_connection( l_smtp_hostname, 25);
18      utl_smtp.helo( l_connection, l_smtp_hostname );
19      utl_smtp.mail( l_connection, p_from );
20      utl_smtp.rcpt( l_connection, p_to );
21      l_temp := l_temp || 'MIME-Version: 1.0' ||  chr(13) || chr(10);
22      l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
23      l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
24      l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
25      l_temp := l_temp || 'Reply-To: ' || p_from ||  chr(13) || chr(10);
26      l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
27                           chr(34) || l_boundary ||  chr(34) || chr(13) ||
28                           chr(10);
29      ----------------------------------------------------
30      -- Write the headers
31      dbms_lob.createtemporary( l_body_html, false, 10 );
32      dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
33      ----------------------------------------------------
34      -- Write the text boundary
35      l_offset := dbms_lob.getlength(l_body_html) + 1;
36      l_temp   := '--' || l_boundary || chr(13)||chr(10);
37      l_temp   := l_temp || 'content-type: text/plain;charset=utf-8' ||
38                    chr(13) || chr(10) || chr(13) || chr(10);
39      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
40      ----------------------------------------------------
41      -- Write the plain text portion of the email
42      l_offset := dbms_lob.getlength(l_body_html) + 1;
43      dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
44      ----------------------------------------------------
45      -- Write the HTML boundary
46      l_temp   := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
47                      chr(13) || chr(10);
48      l_temp   := l_temp || 'content-type: text/html;charset=utf-8' ||
49                     chr(13) || chr(10) || chr(13) || chr(10);
50      l_offset := dbms_lob.getlength(l_body_html) + 1;
51      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
52      ----------------------------------------------------
53      -- Write the HTML portion of the message
54      l_offset := dbms_lob.getlength(l_body_html) + 1;
55      dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
56      ----------------------------------------------------
57      -- Write the final html boundary
58      l_temp   := chr(13) || chr(10) || '--' ||  l_boundary || '--' || chr(13);
59      l_offset := dbms_lob.getlength(l_body_html) + 1;
60      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
61      ----------------------------------------------------
62      -- Send the email in 1900 byte chunks to UTL_SMTP
63      l_offset  := 1;
64      l_ammount := 1900;
65      utl_smtp.open_data(l_connection);
66      while l_offset < dbms_lob.getlength(l_body_html) loop
67          utl_smtp.write_data(l_connection,
68                              dbms_lob.substr(l_body_html,l_ammount,l_offset));
69          l_offset  := l_offset + l_ammount ;
70          l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
71      end loop;
72      utl_smtp.close_data(l_connection);
73      utl_smtp.quit( l_connection );
74      dbms_lob.freetemporary(l_body_html);
75* end;
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
  1  declare
  2   email_text varchar2(2000);
  3   contract_end_date_v date := sysdate;
  4   name_v varchar2(200) := 'Riaz';
  5   begin
  6    email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||'  المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى  <br/>.ولكم جزيل الشكر والتقدير  </font></div>';
  7    html_email(p_to=>'<email@domain>',p_from=>'<email@domain>',p_subject=>'Hello',p_text=>'Hi', p_html=>email_text);
  8*  end;
SQL> /
PL/SQL procedure successfully completed.
Result*
????? Riaz ???????
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
Option3
SQL> ed
Wrote file afiedt.buf
  1  create or replace procedure p_html_email_riaz(
  2      p_to            in varchar2,
  3      p_from          in varchar2,
  4      p_subject       in varchar2,
  5      p_text          in varchar2 default null,
  6      p_html          in varchar2 default null
  7  )
  8  is
  9      l_boundary      varchar2(255) default 'a1b2c3d4e3f2g1';
10      l_connection    utl_smtp.connection;
11      l_body_html     clob := empty_clob;  --This LOB will be the email message
12      l_offset        number;
13      l_ammount       number;
14      l_temp          varchar2(32767) default null;
15      l_smtp_hostname varchar2(50) := '<smtp Server>';
16  begin
17      l_connection := utl_smtp.open_connection( l_smtp_hostname, 25);
18      utl_smtp.helo( l_connection, l_smtp_hostname );
19      utl_smtp.mail( l_connection, p_from );
20      utl_smtp.rcpt( l_connection, p_to );
21      l_temp := l_temp || 'MIME-Version: 1.0' ||  chr(13) || chr(10);
22      l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
23      l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
24      l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
25      l_temp := l_temp || 'Reply-To: ' || p_from ||  chr(13) || chr(10);
26      l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
27                           chr(34) || l_boundary ||  chr(34) || chr(13) ||
28                           chr(10);
29      ----------------------------------------------------
30      -- Write the headers
31      dbms_lob.createtemporary( l_body_html, false, 10 );
32      dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
33      ----------------------------------------------------
34      -- Write the text boundary
35      l_offset := dbms_lob.getlength(l_body_html) + 1;
36      l_temp   := '--' || l_boundary || chr(13)||chr(10);
37      l_temp   := l_temp || 'content-type: text/plain; charset=UTF-8' ||
38                    chr(13) || chr(10) || chr(13) || chr(10);
39      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
40      ----------------------------------------------------
41      -- Write the plain text portion of the email
42  /**
43      l_offset := dbms_lob.getlength(l_body_html) + 1;
44      dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
45  **/
46      ----------------------------------------------------
47      -- Write the HTML boundary
48      l_temp   := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
49                      chr(13) || chr(10);
50      l_temp   := l_temp || 'content-type: text/html;' ||
51                     chr(13) || chr(10) || chr(13) || chr(10);
52      l_offset := dbms_lob.getlength(l_body_html) + 1;
53      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
54      ----------------------------------------------------
55      -- Write the HTML portion of the message
56      l_offset := dbms_lob.getlength(l_body_html) + 1;
57      dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
58      ----------------------------------------------------
59      -- Write the final html boundary
60      l_temp   := chr(13) || chr(10) || '--' ||  l_boundary || '--' || chr(13);
61      l_offset := dbms_lob.getlength(l_body_html) + 1;
62      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
63      ----------------------------------------------------
64      -- Send the email in 1900 byte chunks to UTL_SMTP
65      l_offset  := 1;
66      l_ammount := 1900;
67      utl_smtp.open_data(l_connection);
68      while l_offset < dbms_lob.getlength(l_body_html) loop
69          utl_smtp.write_raw_data(l_connection,
70              utl_raw.cast_to_raw(
71                  dbms_lob.substr(l_body_html,l_ammount,l_offset ) ) );
72          l_offset  := l_offset + l_ammount ;
73          l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
74      end loop;
75      utl_smtp.close_data(l_connection);
76      utl_smtp.quit( l_connection );
77      dbms_lob.freetemporary(l_body_html);
78* end;
SQL>
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
  1  declare
  2   email_text varchar2(2000);
  3   contract_end_date_v date := sysdate;
  4   name_v varchar2(200) := 'Riaz';
  5   begin
  6    email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||'  المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى  <br/>.ولكم جزيل الشكر والتقدير  </font></div>';
  7    p_html_email_riaz(p_to=>'<email@domain>',p_from=>'<email@domain>',p_subject=>'Hello',p_text=>'Hi', p_html=>email_text);
  8*  end;
SQL> /
PL/SQL procedure successfully completed.
Result*
GaSmO Riaz GacMJQc
mQLl GaJ_Qc HGaZac Cd GaZ^O GaNGU H_c SmdJem HJGQmN 12-07-2011
. fZame mQL\l GaJ_\Qc HE]GOI EOGQI GacfGQO GaHTQmI ]m MGa ZOc Q[HJ_c HJLOmO GaZ^O NaGa cOI C^UeG CSHfZmd cd Gamfc fPa_ aaCecmI Ga^Ufl
.fa_c LRma GaT_Q fGaJ^OmQ
*Option4*
[code]
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE send_email_html_test(
2 pi_from IN Varchar,
3 pi_to IN VARCHAR,
4 pi_cc IN Varchar,
5 pi_subj IN VARCHAR,
6 pi_msg CLOB
7 )
8 IS
9 conn utl_smtp.connection;
10 lv_mailhost varchar2(1000);
11 lv_port number;
12 BEGIN
13 lv_mailhost := '<smtp Server>';
14 lv_port := 25;
15 conn := utl_smtp.open_connection(lv_mailhost, lv_port);
16 utl_smtp.helo(conn, lv_mailhost);
17 utl_smtp.mail(conn, pi_from);
18 utl_smtp.rcpt(conn, pi_to);
19 IF pi_cc is not null THEN
20 utl_smtp.rcpt(conn, pi_cc);
21 END IF;
22 utl_smtp.open_data(conn);
23 utl_smtp.write_data(conn, 'MIME-version: 1.0' || utl_tcp.CRLF);
24 utl_smtp.write_data(conn, 'Content-Type: text/html; charset=iso-8859-6' ||
25 utl_tcp.CRLF);
26 utl_smtp.write_data(conn, 'Content-Transfer-Encoding: 8bit' ||
27 utl_tcp.CRLF);
28 utl_smtp.write_data(conn, 'From:' ||pi_from || utl_tcp.CRLF);
29 utl_smtp.write_data(conn, 'To:' ||pi_to || utl_tcp.CRLF);
30 utl_smtp.write_data(conn, 'Cc:' ||pi_cc || utl_tcp.CRLF);
31 utl_smtp.write_data(conn, 'Reply-To:' ||pi_from || utl_tcp.CRLF);
32 utl_smtp.write_data(conn, 'Subject:' ||pi_subj|| utl_tcp.CRLF);
33 utl_smtp.write_data(conn, utl_tcp.crlf);
34 utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(pi_msg));
35 utl_smtp.close_data(conn);
36 utl_smtp.quit(conn);
37 EXCEPTION WHEN others THEN
38 dbms_output.put_line(sqlerrm);
39* END;
40 /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='
<div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b>
يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'
. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى
.ولكم جزيل الشكر والتقدير </font></div>';
7 send_email_html_test('<email@domain>',
8           '<email@domain>',
9 '<email@domain>',
10 'Hello',email_text);
11* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
Riaz افكحترك
ٍرجٌ افترك بافغفك أل افغد افخاص بك سٍلتمٍ بتارٍخ 12-07-2011
. نغفٍم ٍرجٌ افترك بإادة إدارة افكنارد افبشرٍة ٍ حاف غدك ربتك بتجدٍد افغد خفاف كدة أصما أسبنغٍل كل افٍنك نذف ففأمكٍة افصنٌ
.نفك جزٍف افشر نافتدٍر
Option5
SQL> ed
Wrote file afiedt.buf
  1  CREATE OR REPLACE PROCEDURE send_mail_test1 (p_to        IN VARCHAR2,
  2                                         p_from      IN VARCHAR2,
  3                                         p_subject   IN VARCHAR2,
  4                                         p_text_msg  IN VARCHAR2 DEFAULT NULL,
  5                                         p_html_msg  IN VARCHAR2 DEFAULT NULL,
  6                                         p_smtp_host IN VARCHAR2,
  7                                         p_smtp_port IN NUMBER DEFAULT 25)
  8  AS
  9    l_mail_conn   UTL_SMTP.connection;
10    l_boundary    VARCHAR2(50) := '----=*#abc1234321cba#*=';
11  BEGIN
12    l_mail_conn := UTL_SMTP.open_connection(p_smtp_host, p_smtp_port);
13    UTL_SMTP.helo(l_mail_conn, p_smtp_host);
14    UTL_SMTP.mail(l_mail_conn, p_from);
15    UTL_SMTP.rcpt(l_mail_conn, p_to);
16    UTL_SMTP.open_data(l_mail_conn);
17    UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || UTL_TCP.crlf);
18    UTL_SMTP.write_data(l_mail_conn, 'To: ' || p_to || UTL_TCP.crlf);
19    UTL_SMTP.write_data(l_mail_conn, 'From: ' || p_from || UTL_TCP.crlf);
20    UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || p_subject || UTL_TCP.crlf);
21    UTL_SMTP.write_data(l_mail_conn, 'Reply-To: ' || p_from || UTL_TCP.crlf);
22    UTL_SMTP.write_data(l_mail_conn, 'MIME-Version: 1.0' || UTL_TCP.crlf);
23    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: multipart/alternative; boundary="' || l_boundary || '"' || UTL_TCP.crlf || UTL_TCP.crlf);
24    IF p_text_msg IS NOT NULL THEN
25      UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
26      UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/plain; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);
27      UTL_SMTP.write_data(l_mail_conn, p_text_msg);
28      UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
29    END IF;
30    IF p_html_msg IS NOT NULL THEN
31      UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
32      UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/html; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);
33      UTL_SMTP.write_data(l_mail_conn, p_html_msg);
34      UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
35    END IF;
36    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || '--' || UTL_TCP.crlf);
37    UTL_SMTP.close_data(l_mail_conn);
38    UTL_SMTP.quit(l_mail_conn);
39* END;
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
  1  declare
  2   email_text varchar2(2000);
  3   contract_end_date_v date := sysdate;
  4   name_v varchar2(200) := 'Riaz';
  5   begin
  6    email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||'  المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى  <br/>.ولكم جزيل الشكر والتقدير  </font></div>';
  7    send_mail_test1('<email@domain>',
  8                   '<email@domain>',
  9                         'Hello',
10                 'msg',
11                 email_text,
12                 '<smtp Server>',
13                 25);
14*  end;
SQL> /
PL/SQL procedure successfully completed.
Result*
????? Riaz ???????
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
.???? ???? ????? ????????

I worked with Oracle support and was able to find solution. The helping document ids were: 752309.1 & 404389.1

Similar Messages

  • How do i send a html email from office outlook web access?

    how do i send a html email from office outlook web access?

        glenholmes,
    You've come to the right place for help. Sorry to hear that you have had hard time with your Gmail app lately. What steps have you tried to get this to work? We want to ensure that you are able to start sending those messages right away.
    ErinW_VZW
    Follow us on Twitter @VZWSupport

  • Sending HTML emails from Outlook

    I am a Mac user and only know how to send an HTML email from
    Entourage. How do I send an HTML email created in Dreamweaver from
    a PC that uses Microsoft Outlook?

    It's tricky in Outlook (Outlook Express lets you actually
    edit the code directly if I recall correctly). But one clunky way
    to do it regular Outlooks is to display your HTML page in your
    browser. Not the source code, the resulting display page in a
    normal browser window. Select all, copy, then paste into your HTML
    format message in Outlook.
    Keep in mind if you're sending this to more than 50 people or
    so you stand a real good chance of getting that domain/IP black
    listed.

  • How to send a mail with HTML body from Oracle

    Hi Team,
    Can somebody guide me how to send a mail with HTML body from oracle.
    Here is the piece of code i am trying to send a mail.
    procedure SEND_MAIL is
    cursor c_1 is select * from table_name;
    l_mail_id varchar2(40);
    -- ls_mailhost VARCHAR2(64) := Mailhost;
    ls_from VARCHAR2(64) := ‘[email protected]
    ls_subject VARCHAR2(200);
    ls_to VARCHAR2(64);
    l_mail_conn UTL_SMTP.connection;
    ls_left_menu_name VARCHAR2(64);
    ll_emp_num number(8);
    begin
    for i in c_1 loop
    begin
    l_mail_conn := UTL_SMTP.OPEN_CONNECTION('IP');
    UTL_SMTP.HELO(l_mail_conn, 'IP');
    UTL_SMTP.MAIL(l_mail_conn, LS_FROM);
    UTL_SMTP.RCPT(L_mail_conn, LS_TO);
    UTL_SMTP.DATA(l_mail_conn,'From: ' ||ls_from || utl_tcp.crlf ||
    'To: ' ||ls_to || utl_tcp.crlf ||
    'Subject: ' ||ls_subject|| utl_tcp.crlf);
    UTL_SMTP.QUIT(l_mail_conn);
    exception
    when no_data_found then
    null;
    when others then
    RAISE_APPLICATION_ERROR(-20000, 'Failed to send mail due to the following error: ' || sqlerrm);
    end;
    end loop;
    end;
    Thnx

    Hi Nicolas!
    Have you tried to set "Output Format" for "RAW Text" to HTM in SCOT.
    If HTM is missing in your dropdown-list, you could check out table SXCONVERT2. Copy the line with category T/format TXT, and change the format from TXT to HTM. The existing function
    SX_OBJECT_CONVERT__T.TXT does not need to be changed. Now you should be able to choose HTM in SCOT. You will probably need som HTML-tags in your text to make it look good.
    Hope this helps!
    Regards
    Geir

  • ACL error when sending email from Oracle 11g

    Hi,
    It returned something like "error...ACL security" when I tried to send email from Oracle 11g. Is there any security thing that I need to release in Oracle 11g? I used to send emails from Oracle 10g and didn't find any problem.
    Thanks.
    Andy

    In Database 11g Oracle introduced Network Access Control Lists (ACLs) to protect the database from users using the many internet-capable packages such as UTL_INADDR, UTL_HTTP, UTL_TCP, etc.
    Read all about it in the docs and look at the code demos here:
    http://www.morganslibrary.org/library.html
    under DBMS_NETWORK_ACL_...

  • How to sending email from Oracle 6i(Forms)

    How can I send email from Oracle Forms(6i).
    I need to send email to a distribution list(multiple email addresses).

    send email of multiple email address
    [email protected],[email protected],[email protected]
    create or replace function mailout
    (sender in varchar2,
    recipient in varchar2,
    ccrecipient in varchar2,
    subject in varchar2,
    message in varchar2) return number
    is
    crlf varchar2(2) := chr(13)||chr(10);
    connection utl_smtp.connection;
    mailhost varchar2(50) := 'Add email server Ip Address here';
    header varchar2(4000);
    v_num number :=1;
    str number:=0;
    email varchar2(50);
    begin
    connection := utl_smtp.open_connection(mailhost,25);
    header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
    'From: '||sender||' '||crlf||
    'Subject: '||subject||crlf||
    'To: '||recipient||crlf||
    'Cc: '||ccrecipient||crlf||message;
    utl_smtp.helo(connection,mailhost);
    utl_smtp.mail(connection,sender);
    utl_smtp.rcpt(connection,recipient);
    while (instr(ccrecipient,',',1,v_num)>0) loop
    email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
    dbms_output.put_line(email);
    utl_smtp.rcpt(connection,email);
    str:=instr(ccrecipient,',',1,v_num);
    v_num:=v_num+1;
    end loop;
    utl_smtp.open_data(connection);
    -- utl_smtp.write_data(connection,header);
    utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
    utl_smtp.close_data(connection);
    utl_smtp.quit(connection);
    return 0;
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line('Invalid Operation in SMTP transaction');
    return 1;
    when utl_smtp.transient_error then
    dbms_output.put_line('Temporary problem with sending email ');
    return 2;
    when utl_smtp.permanent_error then
    dbms_output.put_line('Permanent problem with sending email ');
    return 3;
    end;

  • How to sending email from Oracle Forms

    How to sending email from Oracle 6i(Forms)
    I need to send email to a distribution list(multiple email addresses).

    send email of multiple email address
    [email protected],[email protected],[email protected]
    create or replace function mailout
    (sender in varchar2,
    recipient in varchar2,
    ccrecipient in varchar2,
    subject in varchar2,
    message in varchar2) return number
    is
    crlf varchar2(2) := chr(13)||chr(10);
    connection utl_smtp.connection;
    mailhost varchar2(50) := 'Add email server Ip Address here';
    header varchar2(4000);
    v_num number :=1;
    str number:=0;
    email varchar2(50);
    begin
    connection := utl_smtp.open_connection(mailhost,25);
    header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
    'From: '||sender||' '||crlf||
    'Subject: '||subject||crlf||
    'To: '||recipient||crlf||
    'Cc: '||ccrecipient||crlf||message;
    utl_smtp.helo(connection,mailhost);
    utl_smtp.mail(connection,sender);
    utl_smtp.rcpt(connection,recipient);
    while (instr(ccrecipient,',',1,v_num)>0) loop
    email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
    dbms_output.put_line(email);
    utl_smtp.rcpt(connection,email);
    str:=instr(ccrecipient,',',1,v_num);
    v_num:=v_num+1;
    end loop;
    utl_smtp.open_data(connection);
    -- utl_smtp.write_data(connection,header);
    utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
    utl_smtp.close_data(connection);
    utl_smtp.quit(connection);
    return 0;
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line('Invalid Operation in SMTP transaction');
    return 1;
    when utl_smtp.transient_error then
    dbms_output.put_line('Temporary problem with sending email ');
    return 2;
    when utl_smtp.permanent_error then
    dbms_output.put_line('Permanent problem with sending email ');
    return 3;
    end;

  • Need to send HTML email from Workflow : problem with sender

    Hi all,
    i need to send HTML email from my Workflow. I did it but i have a problem with the sender. The sender of email is always the agent responsible of workitem, and i don't want the receiver can answer to sender. So i need to put a false email address like nosender.at.mycustomer.com.
    Possible to do that ?
    Thanks for your help.
    Cheers

    Hi rick
    How to change the wf-batch to some other name  as you mention in previous reply. Can you give some details of that. If i use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 how to change the wf-batch name and if i use send mail step in my workflow how to change wf-batch name.
    Regards
    vijay

  • How to send an email from oracle?

    Hi I want to send email from oracle database.
    i have tried following procedure
    create or replace
    2 PROCEDURE send_mail (p_sender IN VARCHAR2,
    3 p_recipient IN VARCHAR2,
    4 p_message IN VARCHAR2)
    5 as
    6 l_mailhost VARCHAR2(255) := 'aria.us.oracle.com';
    7 l_mail_conn utl_smtp.connection;
    8 BEGIN
    9 l_mail_conn := utl_smtp.open_connection(l_mailhost, 25);
    10 utl_smtp.helo(l_mail_conn, l_mailhost);
    11 utl_smtp.mail(l_mail_conn, p_sender);
    12 utl_smtp.rcpt(l_mail_conn, p_recipient);
    13 utl_smtp.open_data(l_mail_conn );
    14 utl_smtp.write_data(l_mail_conn, p_message);
    15 utl_smtp.close_data(l_mail_conn );
    16 utl_smtp.quit(l_mail_conn);
    17 end;
    and when i execute the following
    begin
    send_mail( '[email protected]',
    '[email protected]',
    'Hello arun' );
    end;
    I get the following errors
    ERROR at line 1:
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 97
    ORA-06512: at "SYS.UTL_SMTP", line 139
    ORA-06512: at "TEST.SEND_MAIL", line 8
    ORA-06512: at line 2
    Please help
    Regards
    Arun

    C:\>telnet aria.us.oracle.com 25Only if you work ofr Oracle & start behind their firewall would I expect this to work.
    The SMTP server to which PL/SQL connects needs to be YOUR corporate email (MTA) server & configured to RELAY message.
    Contact your LOCAL postmaster/Network Admin
    NONE of this is related to Oracle RDBMS!

  • Send html email from AIR app

    Hi,
    We've successfully sent plain text email from our AIR application using navigateToUrl and the mailto protocol to launch the user's default email program, but if we try to use html markup in the body it gets sent as plain text.
    Is there any way to send an html email with navigateToUrl, or do we have to use an SMTP mailer? If the latter, is there support in AIR / Flex for SMTP, or do you have to use a 3rd party actionscript library?
    Thanks,
    Greg

    Hi Greg,
    It sounds like your email client is defaulting to plain text, maybe there's an option that would allow you to send emails as html?  Also, is the email body in encoded html?  Not sure how that encoding/decoding would be done using mailto links.
    AIR can do socket communication, so you could directly communicate with an SNTP server.  However you might want to look into third party libraries such as this one, to speed up your development time.
    Chris
    Ps. I don't have any experience with that third party library, maybe someone else with experience doing this could recommend other solutions.

  • Send BW query results as HTML email from ABAP program

    I have published a code sample for sending BW query results as HTML email from ABAP program. if you have any questions or clarification, please post them here.
    the same can be accessed from this link.
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b7658119-0a01-0010-39a9-b600c816f370
    Regards
    Raja
    Message was edited by: Durairaj Athavan Raja

    OK forget about my earlier post.
    do the following changes.
    declare the following variables:
    data: xtext type standard table of solix .
    DATA: atta_sub TYPE sood-objdes .
    after the call of FM SCMS_STRING_TO_FTEXT add the following code.
    CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
      EXPORTING
        ip_solitab        = text
    IMPORTING
       EP_SOLIXTAB       = xtext .
    and after the following statement
    document = cl_document_bcs=>create_document(
                              i_type    = 'HTM'
                              i_text    = text
                              i_length  = conlengths
                              i_subject = subject ).
    add the following code
    CALL METHOD document->add_attachment
                EXPORTING
                  i_attachment_type    = 'htm'
                  i_attachment_subject = atta_sub
                  i_att_content_hex    = xtext.
    now you will have results both in the body as well as attachment. (this is for test you can remove one of them )
    Regards
    Raja

  • Sending email from Oracle through Lotus Domino Server

    Hi,
    I would like to know whether it is possible to send an email from Oracle through a Lotus Domino Server(acting as mail server). If yes, please provide me with the details.
    Thanks in advance

    Have a look at the database UTL_SMTP package

  • Sending email from oracle

    Hi all
    I have a requirement to send emails to managers internal to the company from oracle whenever the orders placed by customers are not acknowleded in certian time like within 6 hrs or so.I could figure out the logic but dont know how to send an email from oracle.
    my logic:
    creating a job which will be scheduled to run every 4 or 5 hrs.this job runs a stored procedure which does all the logic and sends an email.
    any suggesions or source is greatly appreciated.
    thanks and regards in advance
    yugandhar

    Hi,
    for scheduling a job use dbms_job package and to send emails use utl_smtp package is available oracle 8.1.6 and above hope this helps you
    prem

  • Error Using Send Jython HTML Email

    I have imported the procedure from Oracle Support and tried sending mail using Send Jython HTML Email.
    I receive error as below, pls help.
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (most recent call last):
      File "<string>", line 9, in <module>
      File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 245, in __init__
        (code, msg) = self.connect(host, port)
      File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 311, in connect
        raise socket.error, msg
    socket.error: (62, 'Connection refused')
      at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
      at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:322)
      at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
      at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2472)
      at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:47)
      at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
      at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
      at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
      at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
      at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
      at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
      at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
      at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
      at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
      at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
      at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
      at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
      at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
      at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
      at java.lang.Thread.run(Thread.java:744)
    Caused by: Traceback (most recent call last):
      File "<string>", line 9, in <module>
      File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 245, in __init__
        (code, msg) = self.connect(host, port)
      File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 311, in connect
        raise socket.error, msg
    socket.error: (62, 'Connection refused')

    The underlying error here is -> socket.error: (62, 'Connection refused')
    Please debug in the jython code in your procedure to see if you are passing correct parameters.

  • Can't send or receive email from one account

    Just bought the iPod Touch last week. Set up Hotmail account with no problems. However my MacDialup.com account (used to be dial up, but is DSL now) won't work at all. They aren't set up to use SSL, so I turned that off after the iPod automatically tried it. I tried IMAP and POP, tried changing incoming server port number from defalt 143 to 110, triple checked spelling on every single entry including password. Tried calling my ISP tech support and talked to a tech who owns an iPhone and lives in the bay area, but he couldn't figure it out. I tried deleting the MacDialup account then syncing the Touch to my iTunes on my MacBook Pro (which has no problem sending or receiving email from this same account) and had the email settings imported from the MacBook Pro - still no luck. Tomorrow I'll try bringing both my MacBook Pro and iPod Touch into the Genious Bar. Maybe they can figure it out.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Configuration problems with IMAP e-mail on iOS with a non-standard SSL port.
    http://colinrobbins.me/2013/02/09/configuration-problems-with-imap-e-mail-on-ios -with-a-non-standard-ssl-port/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

Maybe you are looking for

  • No accounting document at the time of MIGO in STO

    Hi, I am doing the following process in STO. 1.Create PO ME21N 2. In VL10B  to create a delivery 3. VL02n do the Post goods issue with movement type 641 4. In VF01 create the billing document where you will stock transfer price and Excise duties invo

  • How to restrict some users from viewing a screen of standard transaction

    Hi All, I need to restrict certain user ids from viewing the 'Payment Transactions' screen for the below mentioned transactions. FK01, FK02, FK03, MK01, MK02, MK03, XK01, XK02, XK03 The Basis consultant has tried to configure it. However its not work

  • Saving file/pictures in PS elements 10

    Hi, Just brought PSE10 issue is when i scan a picture and then edit it i go to save it but there is already a IMG file of the same picture. Every time i scan a picture its like it auto saves a copy in a seperate folder labelled the current days date

  • Please, what should I do to get mail working again

    I am going crazy with this one... Mail 2.1.3 - OS 10.4.11. The problem is that I do not receive replies from certain people that are in fact sending replies. Sometimes I email them and get a reply and sometimes not. I have a co-worker that keeps call

  • Memory Capacity when using DHTML Hotspot/pop-ups

    I use Robo v5. I have begun reformatting my predecessor's topics to make them more robust and have been exploring the Robo Help. Perhaps I am not technically-savvy enough to use these features properly, so if I am, please just advise me and I'll see