This is the code of the function that I'm using. And
it's here that the exception occurs.



_______________________________________________________________________
Busca Yahoo!
O servi�o de busca mais completo da Internet. O que voc� pensar o Yahoo! encontra.
http://br.busca.yahoo.com/
        public static void enviaEmail(String remetente, String destinatario, String 
assunto, String corpoMensagem) throws ExcecaoAgrorede{
                //String msgText2 = "This is the text in the message attachment.";
                boolean debug = true;
                // create some properties and get the default Session
                Properties props = new Properties();
                props.put("mail.smtp.host", servidor);
                Session session = Session.getDefaultInstance(props, null);
                session.setDebug(debug);
                try {
                // create a message
                        MimeMessage msg = new MimeMessage(session);
                        msg.setFrom(new InternetAddress(remetente));
                        msg.setRecipients(Message.RecipientType.TO, destinatario);
                        msg.setSubject(assunto);
                        msg.setSentDate(new java.util.Date());
                        // create and fill the first message part
                        MimeBodyPart mbp1 = new MimeBodyPart();
                        mbp1.setText(corpoMensagem);
                        // create the Multipart and its parts to it
                        Multipart mp = new MimeMultipart();
                        mp.addBodyPart(mbp1);
                        // add the Multipart to the message
                        msg.setContent(mp);
                        // send the message
                        Transport.send(msg);
                } catch (MessagingException mex) {
            throw new ExcecaoAgrorede(mex.getMessage());
                }
        }
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to