Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

utl_mail: how to send message as 'multipart/alternative'?

Jens MarreMar 31 2009 — edited Mar 31 2009
Hi,

I´m struggling with the following problem (I´m using Oracle XE on windows):

I want to send an email via utl_mail in both HTML- and text-version, alternatively. I´ve played with different settings in utl_mail.SEND_ATTACH_VARCHAR2.
But when I check the sourcecode in my mail-client, each mail is generated with content-type 'multipart/mixed' (even if I specify att_inline=>FALSE). Thus, the second version is always displayed as an attachment and my mailclient does not choose the best version.

Is there any way to do this in utl_mail or will I have to use utl_smtp?

This is my sourcecode:

<blockquote>
declare

l_from varchar2(100) := ...;
l_to varchar2(100) := ...;
l_cc varchar2(4000) := ...;

l_subject varchar2(100) := 'a multipart eMail via UTL_MAIL';

l_mimetype_1 varchar2(100) := 'text/plain; charset=utf-8';
l_body_1 varchar2(4000) := ...;

l_mimetype_2 varchar2(100) := 'text/html; charset=utf-8';
l_body_2 varchar2(4000) := ... ;

begin
utl_mail.SEND_ATTACH_VARCHAR2(SENDER=>l_from, RECIPIENTS=>l_to, CC=>l_cc
,BCC=>NULL, SUBJECT=>l_subject, MESSAGE=>l_body_1
,MIME_TYPE=>l_mimetype_1
,PRIORITY=>3
,ATTACHMENT=>l_body_2, att_inline=>FALSE,
att_mime_type=>l_mimetype_2);
end;
</blockquote>

Thanks,
Jens
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2009
Added on Mar 31 2009
3 comments
772 views