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.

Similar Messages

  • 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

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

  • HT1541 When i'm trying to send an application as gift using "send gift via email" option, it is not allowing me to buy the app. A pop up appears with message "Please contact itunes support to complete this purchase"

    When i'm trying to send an application as gift using "send gift via email" option, it is not allowing me to buy the app. A pop up appears with message "Please contact itunes support to complete this purchase"

    Okay, so do as it says, contact iTunes customer support.

  • 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());
    %>

  • Idoc/ALE error handling, send to external email

    Hi all,
    I'm developing an IDoc inbound interface for purchase order create using PORDCR1. For the error handling functionality, I need to send an external email describing all of the validation error happened in user-exit EXIT_SAPFKCIM_002. Please kindly tell me how to cater the functionality. I won't use workflow because the error handling can't describe all the error, it just displaying the first error encountered. I also don't want to create any custom object since message type PORDCR1 is available. I think creating a custom FM is a possible way, but if there is another way, please tell me how.
    Thanks,
    Teddy

    Hi Teddy,
    A custom FM is the easiest and simple way.There may be other ways.
    Regards,
    Atish

  • 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());
    %>

  • ERROR WHILE SENDING REPORT THROUGH EMAIL .....

    DEAR ALL
    i have one problem . i am trying to send my report through e-mail.i am working with forms 5.0 and report 3.0 . i am calling report from form.when a client click on the button a report will be generated and this will be send to a specific person in a specific format either in html or pdf.
    but when i click on button it initialize the report and gives the error
    rep-4201 : error occured while initialize the mail subsystem.
    rep-4220 : there is a problem with the mail subsystem.
    if anyone of u have the solution for this please send to me.it will be very much helpfull if you send me the code.
    thanks in adv.
    D prasad.
    null

    well you will have to configure a default mail client on your machine. you can do this by going to control panel->mail in windows os.
    you might also need a .dll file mapi*.dll something. you will need this .dll file in your client machine.
    best of luck

  • Error using sender ws adapter

    Hi,
    I am getting the following error while using the WS adapter at the sender side.
    the SOAP response indicates that an error occurred:
    System Error
    <detail><s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0"><context></context><code>INTERNAL.IN_BIND_WRONG_ADPT</code><text>Sender agreement found belongs to adapter WS, however the current adapter is XI</text></s:SystemError></detail>
    Please help me in resolving this issue.
    Thanks & Regards,
    Hamsa Shree

    Hi Prateek,
    Thanks for ur reply.
    I have used WS adapter at the sender side. And the communication channel provided in the sender agreement is correct.
    Thanks & Regards,
    Hamsa Shree

  • Error using Sender SOAP adapter over HTTPS

    Hi experts,
    Few weeks ago, i developed an interface as follows: SOAP <-> XI <-> RFC.
    I tested the functionality using Altova and everything went well, with HTTP.
    However, when i use HTTPS it fails throwing these error messages (pop ups):
    <i>"HTTP error: could not post file"......
    "Error sending the soap data"</i>
    I have reviewed the SSL certificates installation and everything seems to be ok, but currently i am stuck and do not know how to fix this.
    I have also change the ID comm channel from HTTP to HTTPS with client aut.
    Is there any special service i have to activate? (XI services and SPIGATE are already done)
    Could you please assist?
    Thanks in advance and best regards,
    David

    David,
    have a look @ these threads...u may get some help!!!
    Sender Soap with HTTPS
    https Soap Adapter
    Regards
    Biplab

  • Error when sending payslip to email

    HI,
    Any  HR-ABAP  Experts please help me my client requirement is sending payslip(smartform) to email , so i convert smartform to pdf and attche it to email for this i write one zprogram  its working means pdf file  attched to email  but getting error to open the document error like this "the file is damaged and could not be repaired ",
    i think getting problem in below FM  PAYSLIP_VARIANT = '   '  , how to write varient for CUSTOM SMARTFORMS.
    CALL FUNCTION 'GET_PAYSLIP'
    EXPORTING
    EMPLOYEE_NUMBER = WA_PERNR-PERNR
    SEQUENCE_NUMBER = WA_RGDIR-SEQNR
    PAYSLIP_VARIANT = '   '
    IMPORTING
    P_INFO          = P_INFO
    TABLES
    P_FORM          = P_FORM.

    Hi Venkat,
    Check OSS note 1430123.
    Hope this will help!
    Muktar

  • Getting error when sending text to email

    I get this error on my phone "messages with enhanced features cannot be sent to email". What is it talking about? These are simple word texts. I need to get them to my email for print copies.

    Extended length is a msg over 160 characters in length.
    You could also try the text select and copy/paste them into an email from your gmail account on the phone to the email address you are trying to email.
    Edit:  Here is a quick copy/paste straight form the vtext.com website just for reference:
    Q. What are the features available from Enhanced TXT Messaging?
    A. In addition to the features of TXT Messaging, with a new EMS capable
    handset you can enjoy the following additional features:
    a.. Extended Message Length: An EMS capable handset will allow you to
    compose an Enhanced TXT message over 1000 characters long.
    b.. Text Formatting: Some EMS capable handsets will allow you to apply
    text formatting to the message text such as Bold, Italics, and Underline in
    your Enhanced TXT Message.
    c.. International Characters: An EMS capable handset will allow you to use
    foreign language characters such as 'ü', 'ñ', and 'é' in your Enhanced TXT
    Message.
    d.. Embedded Media Objects: Most EMS capable handsets include a menu of
    sounds, graphics, and animated icons that you can insert into the body of
    your Enhanced TXT Message. These embedded media objects are displayed
    (sounds are played) when the message is opened on the receiving EMS capable
    handset.

  • Error when sending excel as email attachment

    Hi All,
    I am sending excel document as email attachment through F.M. SO_DOCUMENT_SEND_API1. I am getting the attachment but when i open it, it is giving error "The file is not in recognizable format....."
    Please let me know how can i solve this problem.
    Regards,
    Saba

    Hi Saba,
    Check this link I think will surely help.
    [http://www.sap-img.com/abap/sending-email-with-attachment.htm]
    Regards,
    Amit.

Maybe you are looking for

  • Regarding Planning function

    Hello, I have a scenario to fill the plan values of some quantity key figure back to the  planning cube after manually changing it in the plan query. My plan query displays the data aggregated for 0calmonth. Now when i changes the value of this quant

  • Process InfoPackage based on a condition in Process Chain

    Hi, I would like to include a Function Module in my Process Chain.Based on the output of the Function Module (example Flag - 'A','B','C') I would like to load data from Infopackage. Could you please suggest the best possible solution. Thanks, Nimai

  • IDOC types by Function Module

    Hello, I would like to find the IDOC types available by function module.  For example, all idoc types for Production Planning module.  Is there an easy way to get that info? Thanks

  • Userexits or BADIs or BTE's during payment proposal

    Hi, I am looking for Userexits or BADIs or BTE's during payment proposal (F110) I want to do some checks based on currency and payment method. Thanks, Krishna.

  • Converting mp4 to wmv file

    Here is the whole picture. I have a newer iMac and I have a few movies in my itunes that I watch on my ipod touch. I would like to be able to save a copy of these movies to a flash drive memory stick and play them on a PC computer that only has Windo