You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Phillip Qin <Ph...@shareowner.com> on 2004/10/25 22:21:26 UTC

RE: Why mail/session always being set to localhost even Context.x ml says otherwise?

What is in your web.xml?

-----Original Message-----
From: David Lee [mailto:DLEE1@irf.com] 
Sent: October 25, 2004 3:51 PM
To: tomcat-user@jakarta.apache.org
Subject: Why mail/session always being set to localhost even Context.xml
says otherwise?


Tomcat: 5.0.29
OS:  XP
JAVA: 1.5.0
 
Context.xml: jakarta-tomcat-5.0.29\conf\Catalina\localhost
 
<Resource name="mail/Session" auth="Container"
              type="javax.mail.Session"/>
    <ResourceParams name="mail/Session">
      <parameter>
        <name>mail.smtp.host</name>
        <value>company email server</value>
      </parameter>
    </ResourceParams>
 
Java program:
 
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("from email
<ma...@irf.com> "));
        InternetAddress to[] = new InternetAddress[1];
        to[0] = new InternetAddress("to email
<ma...@globalappservices.com> ");
        message.setRecipients(Message.RecipientType.TO, to);
        message.setSubject("test mail session from tomcat");
        message.setContent("test mail session from tomcat", "text/plain");
        Transport.send(message);
 
Catalina ERROR: 
 
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: connect
        at javax.mail.Transport.send0(Transport.java:204)
        at javax.mail.Transport.send(Transport.java:73)
        at javaxml2.UpdateItemServlet.doPost(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:237)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)


!DSPAM:417d591a211741752920360!

RE: Why mail/session always being set to localhost even Context.xml says otherwise?

Posted by Steve Kirk <to...@web-startup.co.uk>.
OK. But is that a correct RFC address?  I understood from the JavaMail
javadocs that the "from" and "to" address values are supposed to be valid
RFC-822 addresses?

So is this allowed 
	"Me <ma...@mydomain.com>"
or should it be 
	"Me <my...@mydomain.com>" 
or just 
	"my.address@mydomain.com"

> -----Original Message-----
> From: Filip Hanik (lists) [mailto:devlists@hanik.com] 
> Sent: Monday 25 October 2004 21:49
> To: Tomcat Users List
> Subject: RE: Why mail/session always being set to localhost 
> even Context.xml says otherwise?
> 
> 
> mailto: could come from someone's email client
> 
> Filip
> 
> -----Original Message-----
> From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
> Sent: Monday, October 25, 2004 3:41 PM
> To: 'Tomcat Users List'
> Subject: RE: Why mail/session always being set to localhost even
> Context.xml says otherwise?
> 
> 
> Not sure that this is your actual problem, but is it correct to use
> "mailto:" within the to/from addresses?
>  
> > -----Original Message-----
> > From: David Lee [mailto:DLEE1@irf.com] 
> > Sent: October 25, 2004 3:51 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Why mail/session always being set to localhost even 
> > Context.xml
> > says otherwise?
> > 
> > 
> > Tomcat: 5.0.29
> > OS:  XP
> > JAVA: 1.5.0
> >  
> > Context.xml: jakarta-tomcat-5.0.29\conf\Catalina\localhost
> >  
> > <Resource name="mail/Session" auth="Container"
> >               type="javax.mail.Session"/>
> >     <ResourceParams name="mail/Session">
> >       <parameter>
> >         <name>mail.smtp.host</name>
> >         <value>company email server</value>
> >       </parameter>
> >     </ResourceParams>
> >  
> > Java program:
> >  
> > 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("from email
> > <ma...@irf.com> "));
> >         InternetAddress to[] = new InternetAddress[1];
> >         to[0] = new InternetAddress("to email
> > <ma...@globalappservices.com> ");
> >         message.setRecipients(Message.RecipientType.TO, to);
> >         message.setSubject("test mail session from tomcat");
> >         message.setContent("test mail session from tomcat", 
> > "text/plain");
> >         Transport.send(message);
> >  
> > Catalina ERROR: 
> >  
> > 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: connect
> >         at javax.mail.Transport.send0(Transport.java:204)
> >         at javax.mail.Transport.send(Transport.java:73)
> >         at javaxml2.UpdateItemServlet.doPost(Unknown Source)
> >         at 
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> >         at 
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >         at
> > 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > icationFilterChain.java:237)
> >         at
> > 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > ilterChain.java:157)
> > 
> > 
> > !DSPAM:417d591a211741752920360!
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Why mail/session always being set to localhost even Context.xml says otherwise?

Posted by "Filip Hanik (lists)" <de...@hanik.com>.
mailto: could come from someone's email client

Filip

-----Original Message-----
From: Steve Kirk [mailto:tomcat-user@web-startup.co.uk]
Sent: Monday, October 25, 2004 3:41 PM
To: 'Tomcat Users List'
Subject: RE: Why mail/session always being set to localhost even
Context.xml says otherwise?


Not sure that this is your actual problem, but is it correct to use
"mailto:" within the to/from addresses?
 
> -----Original Message-----
> From: David Lee [mailto:DLEE1@irf.com] 
> Sent: October 25, 2004 3:51 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Why mail/session always being set to localhost even 
> Context.xml
> says otherwise?
> 
> 
> Tomcat: 5.0.29
> OS:  XP
> JAVA: 1.5.0
>  
> Context.xml: jakarta-tomcat-5.0.29\conf\Catalina\localhost
>  
> <Resource name="mail/Session" auth="Container"
>               type="javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>       <parameter>
>         <name>mail.smtp.host</name>
>         <value>company email server</value>
>       </parameter>
>     </ResourceParams>
>  
> Java program:
>  
> 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("from email
> <ma...@irf.com> "));
>         InternetAddress to[] = new InternetAddress[1];
>         to[0] = new InternetAddress("to email
> <ma...@globalappservices.com> ");
>         message.setRecipients(Message.RecipientType.TO, to);
>         message.setSubject("test mail session from tomcat");
>         message.setContent("test mail session from tomcat", 
> "text/plain");
>         Transport.send(message);
>  
> Catalina ERROR: 
>  
> 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: connect
>         at javax.mail.Transport.send0(Transport.java:204)
>         at javax.mail.Transport.send(Transport.java:73)
>         at javaxml2.UpdateItemServlet.doPost(Unknown Source)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:237)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:157)
> 
> 
> !DSPAM:417d591a211741752920360!
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Why mail/session always being set to localhost even Context.xml says otherwise?

Posted by Steve Kirk <to...@web-startup.co.uk>.
Not sure that this is your actual problem, but is it correct to use
"mailto:" within the to/from addresses?
 
> -----Original Message-----
> From: David Lee [mailto:DLEE1@irf.com] 
> Sent: October 25, 2004 3:51 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Why mail/session always being set to localhost even 
> Context.xml
> says otherwise?
> 
> 
> Tomcat: 5.0.29
> OS:  XP
> JAVA: 1.5.0
>  
> Context.xml: jakarta-tomcat-5.0.29\conf\Catalina\localhost
>  
> <Resource name="mail/Session" auth="Container"
>               type="javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>       <parameter>
>         <name>mail.smtp.host</name>
>         <value>company email server</value>
>       </parameter>
>     </ResourceParams>
>  
> Java program:
>  
> 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("from email
> <ma...@irf.com> "));
>         InternetAddress to[] = new InternetAddress[1];
>         to[0] = new InternetAddress("to email
> <ma...@globalappservices.com> ");
>         message.setRecipients(Message.RecipientType.TO, to);
>         message.setSubject("test mail session from tomcat");
>         message.setContent("test mail session from tomcat", 
> "text/plain");
>         Transport.send(message);
>  
> Catalina ERROR: 
>  
> 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: connect
>         at javax.mail.Transport.send0(Transport.java:204)
>         at javax.mail.Transport.send(Transport.java:73)
>         at javaxml2.UpdateItemServlet.doPost(Unknown Source)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:237)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:157)
> 
> 
> !DSPAM:417d591a211741752920360!
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org