Fala!
seguinte: envio o email, normal, mas só chega o anexo!
o que tá errado? já olhei na api e na net, esse setText funciona em outro código meu, com o mesmo objeto…
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(debug);
// Criando a Mensagem
Message msg = new MimeMessage(session);
fileAttachment = "c:/backup.sql";
// create the message part
MimeBodyPart messageBodyPart = new MimeBodyPart();
//AQUI!
messageBodyPart.setText(statusMsg);
source = new FileDataSource(fileAttachment);
DH = new DataHandler(source);
messageBodyPart.setDataHandler(DH);
messageBodyPart.setFileName(fileAttachment);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Configurando o from and para endereco
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
{
addressTo[i] = new InternetAddress(recipients[i]);
}
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Configurando o Subject e o Content Type
// Put parts in message
// msg.setContent(multipart);
msg.setText(statusMsg);
msg.setSubject(subject);
msg.setContent(multipart, "text/plain");
Transport.send(msg);