Ana
Uma solução seria a utilização de MimeBodyPart, como no exemplo abaixo que
contem uma parte em html e outra parte um arquivo anexado.
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setContent(bodyText, "text/html; charset=iso-8859-1");
// create the second message part
MimeBodyPart mbp2 = new MimeBodyPart();
// attach the file to the message
// testa se o arquivo existe
File chkFile = new File (filename);
if (chkFile.isFile()) {
FileDataSource fds = new FileDataSource(filename);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
} else {
mbp2.setText("erro: arquivo : " + filename + " não foi
encontrado no servidor.");
mbp2.setFileName("arquivo não encontrado.txt");
}
// create the Multipart and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
sds
Marco Zerbini
----- Original Message -----
From: "Ana Paula L. M. Costa" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 10:06 AM
Subject: [java-list] Java Mail
> Alguem sabe como posso enviar um e-mail usando java mail onde a mensagem
tem
> dois content types : text/plain e text/html ???
>
> O meu problema eh o seguinte: tenho que enviar e-mails htmls mas gostaria
> que uma parte do email fosse text/plain onde teria um texto informando o
> endereco do site para ele entrar, caso o visualizador de emails do usuario
> nao suporte emails htmls
>
> Alguem pode me ajudar ????
>
> []'s
> Ana Paula
>
>
>
>
> Segue ai um exemplo de uma mensagem enviada por e-mail pelo elefante:
>
> ----------------------------------------------------------
> Content-Type: text/plain; charset=iso-8859-1
>
> O Elefante
>
> Prezado(a) Ana, consulte agora sua agenda do Elefante
> no endereço: www.elefante.com.br
>
> ----=_Prox-872ydds0srj87ose8-76523889
> Content-Type: text/html; charset=iso-8859-1
>
> <html>
> <head>
> <title>O Elefante - A Agenda do Brasil</title>
> <style type="text/css">
> <!--
> .f0a { font-family: Verdana, Arial, Helvetica; font-size: 14pt}
> .titulos2 { font-family: Verdana, Arial, Helvetica; font-size: 8pt;
> text-decoration: none }
> .titulos2a { font-family: Verdana, Arial, Helvetica; font-size: 9pt;
> text-decoration: none }
> .titulos3 { font-family: Verdana, Arial, Helvetica; font-size: 7pt;
> text-decoration: none }
> .titulos1 { font-family: Verdana, Arial, Helvetica; font-size: 11pt;
> text-decoration: none; font-weight: bold}
> a:hover { font-weight: normal; color: #000099 ; text-decoration: none;
> font-weight: none }
> a.link {text-decoration:none; color: #000000}
> -->
> </style>
> </head>
> <body bgcolor="#FFFFFF" vlink=#0078C8 marginwidth="0" marginheight="0"
> topmargin="0" leftmargin="0" alink="#CCCCCC" link="#0078C8">
> <p>
> <A NAME="top"></A>
> <!-- Table 1 -->
> <table width="660" border="0" cellpadding="0" cellspacing="0"
> align="center">
> <tr>
> <td bgcolor="#0078c8"
> background="http://www.elefante.com.br/img/gn/fios.gif"><img
> src="http://www.elefante.com.br/img/gn/elef-broad1.gif"></td>
> <td bgcolor="#0078c8"
> background="http://www.elefante.com.br/img/gn/fios.gif" width="97%">
>
>
>
>
> ------------------------------ LISTA SOUJAVA ----------------------------
> http://www.soujava.org.br - Sociedade de Usuários Java da Sucesu-SP
> dúvidas mais comuns: http://www.soujava.org.br/faq.htm
> regras da lista: http://www.soujava.org.br/regras.htm
> para sair da lista: envie email para [EMAIL PROTECTED]
> -------------------------------------------------------------------------
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br - Sociedade de Usuários Java da Sucesu-SP
dúvidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------