Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UTL_SMTP: no special characters?

679 views
Skip to first unread message

negg

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
Hi.

I am trying to send german language emails (containing Umlauts) with
UTL_SMTP. Everything would be fine, if the package would act like a
normal telnet-session to the smtp-host. That means, when I am doing
smtp-communication by hand, and I am sending Umlauts, they are sent as
special characters, which are retranslated by normal german
mailclients. UTL_SMTP seems to have difficulties in handling those
Umlauts, and automatically translates an "ä" (=ae) to "a"...

Anybody knows why? Anybody knows how to send Umlaut-emails with
utl_smtp? (I thought this was the year 2000, not 1975.. ;-)

Thanks,
negg.


Sent via Deja.com http://www.deja.com/
Before you buy.

Bastiaan Schaap

unread,
Aug 3, 2000, 3:00:00 AM8/3/00
to
I thought I saw somewhere that it's possible to set the characterset for the
email. This is certainly possible for a varchar2 field. So by setting the
charset for your fields and email, and using the CHR() function you can
insert special characters without a problem. But the you do need to know
which code's represent which symbol though.. For example when using the
US7ASCII character set, the CHR(10) is the carriage-return. You can probably
look up the charactersets in some manual. I even believe I saw a manual
describing how to support multiple languages on your database (8i), it was
on technet.

HTH,

Bastiaan Schaap
Oracle web development,
Desyde BV - Baarn
http://www.desyde.nl/
tel. +31355411711

negg <ne...@my-deja.com> wrote in message news:8m8qsk$f8v$1...@nnrp1.deja.com...

negg

unread,
Aug 4, 2000, 3:00:00 AM8/4/00
to
Thanks, Bastian. I think our database is using the wrong charset. I
came up with a different solution: I encode the email as "quoted-
printable", which seems to work fine for me. I just do a replace like

message := replace(message,'=', '=3D');
message := replace(message,'ä', '=E4');
message := replace(message,'ö', '=F6');
message := replace(message,'ü', '=FC');
message := replace(message,'Ä', '=C4');
message := replace(message,'Ö', '=D6');
message := replace(message,'Ü', '=DC');
message := replace(message,'ß', '=DF');

message := replace(message,'è', '=E8');
message := replace(message,'é', '=E9');
message := replace(message,'à', '=E0');
message := replace(message,'á', '=E1');
message := replace(message,'ë', '=EB');

c := utl_smtp.open_connection('webserver.example.com');
utl_smtp.helo(c, 'myserver.de');
utl_smtp.mail(c, 'm...@myserver.de');
utl_smtp.rcpt(c, p_Recipient);
utl_smtp.open_data(c);
send_header('From', p_From);
send_header('To', p_Recipient);
send_header('Subject', subject);
send_header('MIME-Version', '1.0');
send_header('Content-Type', 'text;');
send_header('Content-Transfer-Encoding', 'quoted-printable');

utl_smtp.write_data(c, utl_tcp.CRLF);

-- send small portions of the message to the smtp host because utl_smtp
-- can't send more than about 1000 chars at a time
enum := CEIL(LENGTH(message)/500);
FOR i IN 1 .. enum
LOOP
utl_smtp.write_data(c, SUBSTR(message,1+500*(i-1),500));
END LOOP;

-- close transmission
utl_smtp.close_data(c);
utl_smtp.quit(c);

Might not be perfect, but I am only a beginner to plsql...

I just can't seem to figure out how to encode the subject to transmit
Umlauts using 7bit characters only...maybe anybody knows?

0 new messages