Send Jython HTML Email Error

Hi,
I have downloaded the procedure to send an email in ODI from
https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=HOWTO&id=424304.1
Now i'm encountering a problem when i'm trying to use it/work with it. The message in the execution tab looks like this
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 9, in ?
File "C:\OraHome_1\oracledi\bin\..\lib\scripting\Lib\smtplib.py", line 187, in __init__
File "C:\OraHome_1\oracledi\bin\..\lib\scripting\Lib\smtplib.py", line 225, in connect
File "C:\OraHome_1\oracledi\bin\..\lib\scripting\Lib\socket.py", line 135, in connect
java.net.ConnectException: Connection refused: connect
     at java.net.PlainSocketImpl.socketConnect(Native Method)
and so on...........
can someone help me out with this issue? I know this is a repeating one but i tried to google it and searched the forum also but was not able to find a solution!
Thanks a lot
Rohan.

Hi Check the below steps
1. Check whether the Oracle data integrator root folder has full read and write privledges
2. Check whether Jython is running (go to <oracledi root>\bin and enter 'jython')
3. Check whether cachedir folder has got created under \lib\scripting folder
4. Download the jythoon procedure from the note: 424304.1
5. Import the Procedure in one of the ODI projects.
6. Enter the necessary parameters in the options tab of the procedure
7. Run the procedure
For i also feel there is some parameter value problem . check the Inverted commas etc
Reshma

Similar Messages

  • 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.

  • 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

  • How to send an HTML email?

    Hey guys
    For the longest time I've been wanting to send HTML emails with Mail, not for promotional stuff, but more for thanking our clients for their business. This is the perfect holiday season to send a Thank You email to them, but I don't want just to send a plain and boring text email, I want graphics on it. I know this wasn't possible to do with any previous OSX until Tiger. This is what the Mail page says... - HTML Message Composition - Mail uses the Safari engine to format newly composed email using HTML. I read another post about an HTML Script to work with mail but it got so confusing that I wasn't able to make it work. Can anybody tell how to make this work? A step-by-step tutorial would be great, not just for me but for all those Mail users that are trying to do the same thing. If Apple can send those HTML emails and Newsletters, why can't we? I don't think they're using a Windows computer or any other email software to do this. Better not! :P
    This is the post I read, but it was posted a year ago, so I know there's got to be something more up to date.
    http://discussions.apple.com/message.jspa?messageID=667497&ft=y&amp;#667497
    Thanks a lot in advance!

    Hello Luis.
    Although RTF with Tiger Mail is basic HTML, you can't compose complex HTML within the body of a message.
    You can use an HTML composer of choice to include embedded images/graphics and/or objects that are stored on a server (to be downloaded/rendered from the server) when the message is opened by recipients instead of attaching images/graphics to the message.
    After saving the document, you can open the document with Safari to ensure the layout and settings are correct and at the menu bar, choose Edit > Mail Contents of This Page.
    A new Mail.app message will open and the contents of the webpage will be copied to the message and it will be sent in its entirety.

  • 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 an HTML email with Automator

    I am trying to send a HTML postcard that I created to a list of 200 friends for a golf tournament. I would like to use Automator to send the emails to each user individually and not to the entire group at once.
    So far I found one Automator action that will create an email message from a Safari page but my trouble is entering the addresses from my address book group for all 200 emails.
    Could someone help me with a workflow?
    Thanks in advance,
    Adam

    Try this
    <%@ page import="sun.net.smtp.SmtpClient,java.io.PrintStream" %>
    <%
    try{
    String host = "IP"; //this is u r IP adress
    String from = "[email protected]"; //mail adress of sender
    String to = "[email protected]"; //mail address whom to
    SmtpClient smtp = new SmtpClient(host);
    smtp.from(from);
    smtp.to(to);
    PrintStream out1 = smtp.startMessage();
    out1.println("To: " + to);
    out1.println("Subject: Hello peter ");
    out1.println();
    out1.println("Hi Peter How r u doing ");
    out1.flush();
    out1.close();
    smtp.closeServer();
    catch(Exception e)
    out.println(e+e.getMessage());
    %>

  • Sending a html email with jsp

    is it possible to send an email with html content and how do i do that

    Try this
    <%@ page import="sun.net.smtp.SmtpClient,java.io.PrintStream" %>
    <%
    try{
    String host = "IP"; //this is u r IP adress
    String from = "[email protected]"; //mail adress of sender
    String to = "[email protected]"; //mail address whom to
    SmtpClient smtp = new SmtpClient(host);
    smtp.from(from);
    smtp.to(to);
    PrintStream out1 = smtp.startMessage();
    out1.println("To: " + to);
    out1.println("Subject: Hello peter ");
    out1.println();
    out1.println("Hi Peter How r u doing ");
    out1.flush();
    out1.close();
    smtp.closeServer();
    catch(Exception e)
    out.println(e+e.getMessage());
    %>

  • Flat file to table - send mail report on error

    Hello,
    I've created simple project - loading data from csv flat file to oracle database table, using this tutorial: http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/odi_project_flatfile-to-table/odi_project_flatfile-to-table.htm. Now, I need to add support for sending mail to this project. Mail, with error descritpion should be sent to Administrator via smtp server when error occurs.
    Can you provide any step by step description how to add this feature in my case? I know this should be possible via ODISendMail, but I was unable to find any basic, step by step tutorial. Can you help me?

    960949 wrote:
    Ok, so is there any other solution to send mail? I found this post: Send Jython HTML Email Error but link to procedure is inactive: https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=HOWTO&id=424304.1
    You need to login to My Oracle Support in order to download the procedure code .
    For this you need a valid Oracle CSI

  • How to send html email notification in bpel

    hi gurus,
    i want to send html email notification from bpel.
    before, i already successful send html email with attachment, but when i send an email without attachment, then the body message will turn into a plain text.
    as i check from the email accepted, email with attachment will have a mime type "text/html" but if no attachment then it will be "text/plain"
    from the bpel configuration, by default the mime type already set to "text/html; charset=UTF-8", below is the sample configuration in my bpel process
    [quote]
    <copy>
                                    <from>string('text/html; charset=UTF-8')</from>
                                    <to variable="varNotificationReq"
                                        part="EmailPayload">
                                        <query>ns10:Content/ns10:MimeType</query>
                                    </to>
                                </copy>
    [/quote]
    i think this suppose to be a easy configuration, but i'm not sure whether i miss something in configuration the email process or this is a bugs in bpel.
    environment:
    linux
    jdev 11.1.1.6
    do u guys ever facing a same problem or have a solution to this ? please throw some light.
    thanks
    ===
    update, i found a temporary solutions.
    so i add a attachment from the process design, and then i change it from the source.
    [quote]
    <copy>
                                    <from>
                                        <literal>
                                            <Content xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
                                                <MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">multipart/alternative</MimeType>
                                                <ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
                                                    <MultiPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
                                                        <BodyPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
                                                            <MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
                                                            <ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
                                                            <BodyPartName xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
                                                        </BodyPart>                                            
                                                    </MultiPart>
                                                </ContentBody>
                                            </Content>
                                        </literal>
                                    </from>
                                    <to variable="varNotificationReq"
                                        part="EmailPayload">
                                        <query>ns10:Content</query>
                                    </to>
                                </copy>
    <copy>
                                    <from>string('text/html; charset=UTF-8')</from>
                                    <to variable="varNotificationReq"
                                        part="EmailPayload">
                                        <query>ns10:Content/ns10:ContentBody/ns10:MultiPart/ns10:BodyPart[1]/ns10:MimeType</query>
                                    </to>
                                </copy>
                                <copy>
                                    <from>string('your message')</from>
                                    <to variable="varNotificationReq"
                                        part="EmailPayload">
                                        <query>ns10:Content/ns10:ContentBody/ns10:MultiPart/ns10:BodyPart[1]/ns10:ContentBody</query>
                                    </to>
                                </copy>
    [/quote]
    make sure you put the mime type multipart/alternative into the email payload content. by default, when you add attachment, it will generate mime type multipart mixed automatically.
    if you don't change it to multipart/alternative, your email will show a attachment, but actually your email doesn't contain any attachment.
    and then for the message and mimetype make sure you have that ns10:bodypart, because this email already been set as a multipart email.
    when you add attachment, by default it will generate 2 body part, first one is for the body message and the second one is for the attachment. since i only want to use the body message only, then i have to erase the second bodypart
    with this workaround, i can send a html email without attachment perfectly.
    but i have to take note, when i updating the email process from process design, then the source will be generated again automatically, and the edited one will be replaced.
    thanks.

    Make sure you upload all of the images used in your email to a server you control. Then, change your image paths to point to those uploaded images with absolute links.
    You will get marked as spam if you attempt to send images as attachments to a large list of recipients and most email clients won't download images to begin with, so make sure your html email makes sense with broken pictures.
    CSS support is spotty across email clients, if you use css, make sure it's inline, not embedded in the <head> or externally linked in the <head>. Some email clients strip out the <head> section entirely.
    Basically, you need to design your html email as if you haven't moved out of the 90's yet, as far as web design is concerned, in order to get maximum cross client compatibility.
    Then, when you're ready, I would suggest using a service like www.icontact.com or www.constantcontact.com if your subscriber list is anywhere over 100 or so recipients.

  • How to send HTML email in Outlook

    How do I send a HTML email in Outlook 2003? I figured out how to do it in Outlook Express. I can't figure out how to open the place for entering the source code like OE. How do I do this.
    Yes, I have already posted the HTML onto a server.
    Yes, the CSS is in the HTML file.

    Don't use Outlook or Outlook Express for this.
    My recommendation is the same as Joe's.  Either use a dedicated bulk email software or a bulk email service like MailChimp, etc...
    If your list is especially large, and you attempt to send to a volume that's prohibited by your server or email service provider, you could be in violation of their anti-spamming rules.  You don't want that.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com
    Sorry Joe. Didn't mean to call you EagerBob.

  • 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.

  • Cgiemail and sending html emails

    Anyone out there know how to send an html email
    using cgiemail? From what I have found on web there needs to be
    something special in the header???? I know how to send just .txt
    emails but client wants to send html email regardless how much I
    warned them on spam and html emails. Any help would be greatly
    appreciated. I have exhausted my search for the answer on the web
    other than it can be done.
    Thanks bunches! skh

    You will need to do your homework.
    Look at the properties (headers) of an html email you
    received.
    Read the SMTP RFCs.
    Test your email through programs like Spam Assassin.
    Test your email in various email programs.
    Good luck.
    -Rb

  • How to send HTML emails on the emac?

    Help! I need to find a quality software that allows me to send out HTML emails. I have an older eMac, running 10.3.2
    This would be for HTML emails with photos, links and personalized message boxes.

    The best thing I've tried is Max Bulk Mailer. Do a search for it on VersionTracker. It's about $50. or so.
    If you're just looking to send one offs, you can do it with a hotmail account - just make sure you pull out the doctype tag (you should do this for any html email).

  • 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.

  • UTL_SMTP send HTML email with embedded image?

    Hi, I can use UTL_SMTP to send an HTML email ok, but does anyone have an example of how to include an inline embedded image in the email? Thanks!

    If you want to send the html page and have it
    reference the images and css files on your web
    site, that's pretty easy. Just create a message
    with text/html content that is your html page.
    If you want to include all the images and css files
    in your message along with the html page, you'll
    need to create a multipart/related message and
    you'll need to change all the html to reference the
    images and css files using "cid:" references.

Maybe you are looking for

  • Automatic Batch Determination while doing MFBF

    Hello PP Gurus, I have a scenario related to Repetitive Manufacturing. I am doing MFBF transaction and doing Assembly backflush by clicking Post with correction. One of the components is batch managed. My requirement is : On selection screen of MFBF

  • Need details on usage of "createStatement" of OCCI, for less parse calls

    Hi All, I am working on CPP code where i am using OCCI for connecting to database and perform actions like INSERT, UPDATE, DELETE etc. on different tables (which includes huge tables which contain millions of records). I have requested for AWR report

  • 2lis_18_i0item Datasoure - 0records in RSA3..

    Hi    I fill the setup table for Application 18 (Notification - Items) and system gives a messge " 54 documents read successfully".Then i tried checking the Relevant setup table in SE16 ,but it shows 0 entries..I cant find any reason why the table's

  • Issues with Flash Player 11

    Why is it that only Flash Player 11 virus's my computer and causes advertisements to play in the background of my computer. I want to be able to play the games I was playing on my computer but unfortunately i need this garbage of a Flash Player progr

  • HOW DO I IMPORT PHOTOS FROM MY CD DRIVE

    HOW DO I IMPORT PHOTOS FROM MY CD DRIVE, I HAVE TRIED FOR 2 DAYS TO DO WHAT SHOULD BE A BASIC OPERATION, LIKE PLUGGING IN AN SD CARD! WHAT AM I MISSING?