Yes, you need an SMTP server. If you've got Outlook Express running,
you can use the same server it's using.
--
Len

On 3/11/06, Mark Whitby <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I'm currently getting the following error when trying to test the JavaMail 
> set up: javax.mail.MessagingException: Could not connect to SMTP host: 
> localhost, port: 25; nested exception is: java.net.ConnectException: 
> Connection refused: connect
>
> I'm using Tomcat 5.5 and have installed the jar files correctly as stated 
> here: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
>
> I'm guessing that there's a problem with my SMTP settings.  However, 
> (apologise if I sound dense here) but the only mail client I have on my PC is 
> Outlook Express.  Am I right in saying then that as well as JavaMail that I 
> need an smtp server?  If so where can I get one?  If not where am I going 
> wrong?
>
> I have the following setups in my files:
>
> context.xml:
>
> <Context>
>
>  <ResourceLink name="jdbc/TestDB"
>   type="javax.sql.DataSource"
>      global="jdbc/TestDB"/>
>
> <ResourceLink name="mail/Session" auth="Container"
>             type="javax.mail.Session"
>             mail.smtp.host="localhost"/>
>
> </Context>
>
> web.xml:
>
> <resource-ref>
>   <description>JavaMail Connection</description>
>   <res-ref-name>mail/Session</res-ref-name>
>   <res-type>javax.mail.Session</res-type>
>   <res-auth>Container</res-auth>
> </resource-ref>
>
> Finally this is the code i'm testing:
>
> Context initCtx = new InitialContext();
>             Context envCtx = (Context) initCtx.lookup("java:comp/env");
>             Session session = (Session) envCtx.lookup("mail/Session");
>
>             Message message = new MimeMessage(session);
>             message.setFrom(new InternetAddress("[EMAIL PROTECTED]"));
>             InternetAddress to[] = new InternetAddress[1];
>             to[0] = new InternetAddress("[EMAIL PROTECTED]");
>             message.setRecipients(Message.RecipientType.TO, to);
>             message.setSubject("Test email");
>             message.setContent("Test email", "text/plain");
>             Transport.send(message);
>
> Can anyone tell me where I'm going wrong?
>
> Many thanks
>
> Mark Whitby
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to