Hey Toby

I've not really done much with SMTP from Java so I'm guessing alot here
but...

You're connecting to localhost for your SMTP server - shouldn't that be your
ISP (or intranet) SMTP server?

James

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 12, 2001 8:18 AM
Subject: [dom4j-dev] Problems with JavaMail during Test of org.dom4j.mime.*


> Hi everybody,
>
> I currently written the Mime-support for dom4j in order to handle a dom4j
> document as an attachment without serializing it to disk and being cared
as
> text/plain.
>
> Unfortunatly I have problem druing test with Java Mail. Heres the code:
>
>      Properties prob = System.getProperties();
>      prob.put(".smtp.foo.com", "smtp.foo.com");
>
>     Session session = Session.getDefaultInstance(prob, null);
>
>     Store store = session.getStore("pop3");
>     store.connect("host", "user", "password");
>
>     MimeMessage message = new MimeMessage(session);
>     message.setFrom(new InternetAddress("[EMAIL PROTECTED]"));
>     message.addRecipient(Message.RecipientType.TO, new
> InternetAddress("[EMAIL PROTECTED]"));
>     message.setSubject("Test of Document DataHandler");
>     message.setText("This is only a test if dom4j mime package is
working");
>
>     // Create the message part
>     BodyPart messageBodyPart = new MimeBodyPart();
>     // Fill the message
>     DataHandler handler = new DataHandler(new DocumentDataSource(this.doc,
> new File  ("Message.xml")));
>     handler.setCommandMap(new DocumentCommandMap());
>     messageBodyPart.setDataHandler(handler);
>     Multipart multipart = new MimeMultipart();
>     multipart.addBodyPart(messageBodyPart);
>
>     message.setContent(multipart);
>     // message.saveChanges();
>
>     Transport.send(message);
>
> When I exceute the following code I got following JavaMail specific
> question:
>
> 1) testMimeMapping(org.dom4j.mime.MimeMappingTest)
> javax.mail.SendFailedException: Sending failed;
>   nested exception is:
> javax.mail.MessagingException: Could not connect to SMTP host: localhost,
> port: 25;
>   nested exception is:
> java.net.ConnectException: Connection refused: no further information
>
> I put the mail.jar, pop3.jar and smtp.jar in classpath. Do I need further
> jar's in classpath or is the code wrong??? I do a pop3 connect frist
because I
> use a web interface similar to yahoo and excuete sending via smtp.
>
> Any help would be appricated, because I think the mime-support would be
> really nice for dom4j (for your convenience ;-) ) and I won't check in any
> untesetet code ;-)
>
> Happy coding & thx
>
> -toby
>
>
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
>
> GMX Tipp:
>
> Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1!
> http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a
>
>
> _______________________________________________
> dom4j-dev mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dom4j-dev
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to