E-mail sending via SMTP Portuguese accent error

DBA Geral (instalação, configuração do banco, scripts do Sql*Plus, shell scripts, batch scripts, etc...)
Post Reply
Desenvolvedor
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 23
Joined: Wed, 26 Dec 2007 12:40 pm
Location: SP

Poessoal,

I am using an SMTP package for sending e-mial.
If I send e-mail by the Oracle Bank with the text configuration I will receive the e-mail like this:

Select all

Configurac?o
I did some searches and used the command

Select all

ALTER SESSION SET NLS_LANGUAGE='BRAZILIAN PORTUGUESE';
]]
But it did not solve my problem.

My Oracle version: Oracle9i Enterprise Edition Release 9.2.0.1.0
After the Alter Session I performed the following SELECT

Select all

 
 select * from nls_session_parameters; 
 
PARAMETER                      VALUE 
------------------------------ ---------------------------------------- 
NLS_LANGUAGE                   BRAZILIAN PORTUGUESE 
NLS_TERRITORY                  AMERICA 
NLS_CURRENCY                   $ 
NLS_ISO_CURRENCY               AMERICA 
NLS_NUMERIC_CHARACTERS         ., 
NLS_CALENDAR                   GREGORIAN 
NLS_DATE_FORMAT                DD-MON-YY 
NLS_DATE_LANGUAGE              BRAZILIAN PORTUGUESE 
NLS_SORT                       WEST_EUROPEAN 
NLS_TIME_FORMAT                HH.MI.SSXFF AM 
NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM 
NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR 
NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR 
NLS_DUAL_CURRENCY              $ 
NLS_COMP                       BINARY 
NLS_LENGTH_SEMANTICS           BYTE 
NLS_NCHAR_CONV_EXCP            FALSE 
 
17 rows selected. 
 
I do not know anymore What to do, please someone has any tips or some link with help.


Thanks,

Rômulo
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Brother,

I was able to solve this problem in the body of the email.
I changed the Content-Type for HTML presentation and, I created a function, which converted the accentuation from the correspondent in HTML.


Example:
[/b]
If you come ", I convert to & atilde;
If it came "to", I convert to & aacute;

and so on.
NET There are conversion tables, containing all characters.

Only one:

I could not perform this correction in the e-mail subject.
In this case, I created another function (with translate), which converted the "to" to ", that is, I removed the accent on the subject of the e-mail.

Anything, send it there.
Desenvolvedor
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 23
Joined: Wed, 26 Dec 2007 12:40 pm
Location: SP

Trevisolli
araraquara-sp,


The problem is that I want to send e-mail with accent case I use your idea I will have problems because the situation is as follows e-mail in Brazil tm to have accentuation anyway.


If you have another idea I thank you

Thanks,
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Brother,

The person who developed the code below, said that it worked perfectly:

Select all

 
       c:= utl_smtp.open_connection('111.111.111.111');  -- Conexao ao servidor 
       utl_smtp.helo(c, 'meudom.br');                -- Dominio 
       utl_smtp.mail(c, P_ORIGEM); 
       utl_smtp.rcpt(c, P_DESTINATARIO); 
       utl_smtp.open_data(c); 
 
       UTL_SMTP.WRITE_RAW_DATA( c,UTL_RAW.CAST_TO_RAW('From:'    ||P_CAB_ORIGEM ||utl_tcp.CRLF)); 
       UTL_SMTP.WRITE_RAW_DATA( c,UTL_RAW.CAST_TO_RAW('To:'      ||P_DESTINATARIO|| utl_tcp.CRLF)); 
       UTL_SMTP.WRITE_RAW_DATA( c,UTL_RAW.CAST_TO_RAW('Subject:' ||P_TITULO||utl_tcp.CRLF)); 
 
       utl_smtp.write_data(c,' '||utl_tcp.CRLF); 
       utl_smtp.write_raw_data(c,utl_raw.cast_to_raw(utl_tcp.CRLF||'Ãéíóãõç')); 
 
       utl_smtp.close_data(c); 
       utl_smtp.quit(c); 
does a test there (an adaptation to your case) and, if it works (or not), give a hello to us, beleza?
Desenvolvedor
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 23
Joined: Wed, 26 Dec 2007 12:40 pm
Location: SP

Guys,
Thanks for the help ....
there goes my code with implementation of friends for all ..

Select all

 
CREATE OR REPLACE PROCEDURE send_mail AS 
        C UTL_SMTP.CONNECTION; 
        P_ORIGEM        VARCHAR2(100)   :='administrador@xyz.com.br'; 
        P_DESTINO       VARCHAR2(100)   :='manoel@xyz.com.br'; 
        P_COPIA         VARCHAR2(100)   :='paulo@xyz.com.br'; 
        P_TITULO        VARCHAR2(100)   :='jose@xyz.com.br'; 
        P_ASSUNTO       VARCHAR2(100)   :='E-mail para teste Oracle: Rômulo'; 
        P_TEXTO         VARCHAR2(200)   :='teste de acentuação, lição, concessão, visão, rômulo,vocês'; 
 BEGIN 
        c:= utl_smtp.open_connection('smtp.picture.com.br',25); 
        utl_smtp.helo(c, 'smtp.picture.com.br'); 
        utl_smtp.command (C, 'AUTH LOGIN'); 
        utl_smtp.command (C, utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw(('administrador@xyz.com.br'))))); 
        utl_smtp.command (C, utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw(('sid')))));   --> senha 
        UTL_SMTP.MAIL (C, ('<' || P_ORIGEM || '>')); /* E-mail de quem está mandando */ 
        UTL_SMTP.RCPT (C, ('<' || P_DESTINO|| '>')); /* Para quem vou mandar */ 
        UTL_SMTP.RCPT (C, ('<' || P_COPIA|| '>')); /* Para quem vou mandar */ 
        -- 
        utl_smtp.open_data(c); 
        UTL_SMTP.WRITE_RAW_DATA( c,UTL_RAW.CAST_TO_RAW('From:'    ||P_ORIGEM||utl_tcp.CRLF)); 
        UTL_SMTP.WRITE_RAW_DATA( c,UTL_RAW.CAST_TO_RAW('To:'      ||P_DESTINO||utl_tcp.CRLF)); 
        UTL_SMTP.WRITE_RAW_DATA( c,UTL_RAW.CAST_TO_RAW('Cc:'      ||P_COPIA  ||utl_tcp.CRLF)); 
        UTL_SMTP.WRITE_RAW_DATA( c,UTL_RAW.CAST_TO_RAW('Subject:' ||P_ASSUNTO||utl_tcp.CRLF)); 
        -- 
        utl_smtp.write_data(c,' '||utl_tcp.CRLF); 
        utl_smtp.write_raw_data(c,utl_raw.cast_to_raw(utl_tcp.CRLF||P_TEXTO)); 
        -- 
        utl_smtp.close_data(c); 
        UTL_SMTP.QUIT (C); 
        -- 
END; 
gilbertoca
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 372
Joined: Tue, 24 Jan 2006 3:33 pm
Location: Palmas - TO
Contact:

Developer wrote: Pessoal,

I am using an SMTP package for sending e-mial.
If I send e-mail by Bank Oracle with the text configuration I will receive the email like this: Configuration

I did some searches and used the command

Select all

ALTER SESSION SET NLS_LANGUAGE='BRAZILIAN PORTUGUESE';
But it did not solve my problem.
Rômulo

The correct here is

Select all

BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252
Reference: http://download.oracle.com/docs/cd/B105 ... .htm#49560 http://www.oracle.com/technology/tech/g ... %20faq.htm ]
Gilberto
arvinson
Rank: Estagiário Júnior
Rank: Estagiário Júnior
Posts: 1
Joined: Fri, 03 Jul 2009 11:17 am
Location: Belém - Pará

Guys,
I read the answer and did not understand why my code was not working.
After some tests would like to highlight that what makes it work is the transformation of the line to RAW.
ie the use of UTL_SMTP.WRITE_RAW_DATA combined with UTL_RAW.CAST_TO_RAW

Alexander
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest