| Autor |
Mensagem |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 27/07/2009 13:43:33
|
VeraApFigueiredo
JavaChild
Membro desde: 14/12/2008 16:00:39
Mensagens: 133
Offline
|
Boa tarde pessoal,
É a primeira vez que faço o envio de email usando o java.
Fiz esse código abaixo:
Properties p = new Properties();
p.put("mail.host", "ferrari2.tropiconet.com.br");
Session session = Session.getInstance(p, null);
MimeMessage msg = new MimeMessage(session);
try {
// "de" e "para"!!
msg.setFrom(new InternetAddress("info.informacoes@teste.com.br"));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress("info.informacoes@teste.com.br"));
// nao esqueca da data!
// ou ira 31/12/1969 !!!
msg.setSentDate(new Date());
msg.setSubject("Mensagem para oficializaçao");
msg.setText("Mensagem oficializada com sucesso");
// eviando mensagem (tentando)
Transport.send(msg);
} catch (AddressException e) {
// nunca deixe catches vazios!
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
// nunca deixe catches vazios!
}
Porém quando compilo está dando erro na linha "Transport.send(msg)"
" javax.mail.MessagingException: Could not connect to SMTP host: ferrari2.tropiconet.com.br, port: 25;
nested exception is: java.net.ConnectException: Connection refused"
Alguém tem alguma idéia do que pode ser isso.
Obrigada.
|
|
|
 |
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 27/07/2009 13:56:48
|
Metaleiro
Virtual Machine Man
![[Avatar]](/images/avatar/c2155acc6d5bcda7debfb19c3abef4af.jpg)
Membro desde: 06/07/2006 10:55:54
Mensagens: 669
Localização: São Bernardo do Campo - SP
Offline
|
Enviando emails com Java
java.net.ConnectException: Connection refused
|
"Why, Mr. Anderson? Why do you do it? Why get up? Why keep fighting? Do you believe you're fighting for something? For more than your survival? Can you tell me what it is? Do you even know? Is it freedom? Or truth? Perhaps peace? Yes? No? Could it be for love? Illusions, Mr. Anderson. Vagaries of perception. The temporary constructs of a feeble human intellect trying desperately to justify an existence that is without meaning or purpose. And all of them as artificial as the Matrix itself, although only a human mind could invent something as insipid as love. You must be able to see it, Mr. Anderson. You must know it by now. You can?t win. It?s pointless to keep fighting. Why, Mr. Anderson? Why? Why do you persist?"
Neo :
-Because is my choice
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 27/07/2009 14:47:26
|
marcosharbs
Virtual Machine Man
![[Avatar]](/images/avatar/8d497e638156b68197ed9ad0978eaeaf.jpg)
Membro desde: 01/08/2008 11:53:39
Mensagens: 645
Offline
|
tem que ser um smtp válido.
|
======================================================
Blog com foco em desenvolvimento web com java.
http://marcosharbs.wordpress.com/
====================================================== |
|
|
 |
|
|