FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Send Unicode email with Oracle





shamil
I know this is not right place for discussing Oracle related issues. But http://www.frihost.com/forums/vt-59029.html

Solved. Below code is oracle procedure which sends unicode characters contained mail. I use it to send mail to Outlook. Hope this will be usefull to who needs it. Here is the code:
Code:
create or replace procedure sendMail(
   p_recipient_email varchar2,
   p_recipient_alias varchar2,
   p_subj varchar2,
   p_body varchar2,
   p_mailserv varchar2   
  ) is
    subj raw(2000) := utl_raw.cast_to_raw('Subject: '||p_subj|| UTL_TCP.CRLF);
    bod raw(32000) := utl_raw.cast_to_raw(p_body);
    c UTL_SMTP.CONNECTION;
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
    BEGIN
      UTL_SMTP.WRITE_DATA(c, name || ': ' || header || UTL_TCP.CRLF);
    END;
  BEGIN
    c := UTL_SMTP.OPEN_CONNECTION(p_mailserv);
    UTL_SMTP.HELO(c, 'mail.mydomain.com');
    UTL_SMTP.MAIL(c, 'supervisor@box.az');
    UTL_SMTP.RCPT(c, p_recipient_email);
    UTL_SMTP.OPEN_DATA(c);
    send_header('From','"Shamil" <supervisor@box.az>');
    send_header('To',p_recipient_alias||' '||p_recipient_email);
    UTL_SMTP.write_raw_data(c,subj);
    send_header('Content-Type', 'text/html;charset=utf-8');
    UTL_SMTP.write_raw_data(c, bod);
    UTL_SMTP.CLOSE_DATA(c);
    UTL_SMTP.QUIT(c);
  EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
      BEGIN
        UTL_SMTP.QUIT(c);
      EXCEPTION
        WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
          NULL;
      END;
      raise_application_error(-20000,
        'Failed to send mail due to the following error: ' || sqlerrm);
end sendMail;
Related topics
HELP! I registered, but never got my confirmation email.
jyoko@habbotouch.com Can Send, but not Receive..?
How Many Email Accounts Are Enough?
Problem with email through Thunderbird
Unable to send email [Server 2 - DirectAdmin]
send an email from internet...
Email problem
Send an email to many people?
Send an email to many people at once?
unable to send an email
Form Processing Email Not Sent
Email Problems - Please Look
Help with php email
How to send an email from a PHP script?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.