You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mighty Tornado <mi...@gmail.com> on 2007/04/06 07:30:55 UTC
sending smtp mail failure
Hi,
I set up a small web app and the servlet is supposed to send an email using
JavaMail. But I am getting exceptions - Connection Timed out every time. I
am using Gmail as an smtp server to bounce emails off. How can I avoid the
Connection Timed out exception? Could it be because of my firewall? If so,
which process should I permission?
Thank you,
MT
Re: sending smtp mail failure
Posted by Rashmi Rubdi <ra...@gmail.com>.
It looks like someone has solved this already:
http://forum.java.sun.com/thread.jspa?forumID=43&threadID=667323
http://forum.java.sun.com/thread.jspa?forumID=43&threadID=5121116
-Rashmi
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: error-page
Posted by Eqbal <eq...@yahoo.com>.
I did not realize/know that this will create a
problem. I apologize for doing that. I have sent a new
message for my topic/question. Thanks for bringing it
to my attention.
--- Mark Thomas <ma...@apache.org> wrote:
> When starting a new thread (ie sending a message to
> the list about a
> new topic) please do not reply to an existing
> message and change the
> subject line. To many of the list archiving services
> and mail clients
> used by list subscribers this makes your new
> message appear as part
> of the old thread. This makes it harder for other
> users to find
> relevant information when searching the lists.
>
> This is known as thread hijacking and is behaviour
> that is frowned
> upon on this list. Frequent offenders will be
> removed from the list.
> It should also be noted that many list subscribers
> automatically
> ignore any messages that hijack another thread.
>
> The correct procedure is to create a new message
> with a new subject.
> This will start a new thread.
>
> Mark
> tomcat-user-owner
>
>
---------------------------------------------------------------------
> To start a new topic, e-mail:
> users@tomcat.apache.org
> To unsubscribe, e-mail:
> users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail:
> users-help@tomcat.apache.org
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: error-page
Posted by Mark Thomas <ma...@apache.org>.
When starting a new thread (ie sending a message to the list about a
new topic) please do not reply to an existing message and change the
subject line. To many of the list archiving services and mail clients
used by list subscribers this makes your new message appear as part
of the old thread. This makes it harder for other users to find
relevant information when searching the lists.
This is known as thread hijacking and is behaviour that is frowned
upon on this list. Frequent offenders will be removed from the list.
It should also be noted that many list subscribers automatically
ignore any messages that hijack another thread.
The correct procedure is to create a new message with a new subject.
This will start a new thread.
Mark
tomcat-user-owner
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: error-page
Posted by Eqbal <eq...@yahoo.com>.
I have an error-page directive in a webapp's web.xml
to display a custom error page on 404/500 errors. . It
works on my local machine which has Tomcat 5.5.17, but
it does not work on my server which has 5.5.20
installed. Any ideas?
Below is my web.xml:
----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Navigation Update
Application</display-name>
<!-- Standard Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>navigationPassword.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-bean.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-html.tld
</taglib-location>
</taglib>
</web-app>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: sending smtp mail failure
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
MT,
Mighty Tornado wrote:
> I have ZoneAlarm running, but normally Zone Alarm notifies me if a program
> from within is trying to access the internet and let's me block it or
> let it
> go. Is it possible that ZA is blocking not my request to connect to the
> smtp
> server but the server's reply?
Yes, but most firewalls are configured to allow ESTABLISHED
communication channels to flow bidirectionally without additional
configuration. Making an outgoing TCP/IP connection should be possible
as long as port 25 is open from your machine -> the Internet.
There could be another firewall in the way, too.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGLLNV9CaO5/Lv0PARAuRhAKCsgi+OpWLahq7CtOKWwZ2yCJYfuQCgvgK8
sLzykRoL6VBG0A3SD7q6adk=
=9OMT
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: sending smtp mail failure
Posted by Mighty Tornado <mi...@gmail.com>.
I have ZoneAlarm running, but normally Zone Alarm notifies me if a program
from within is trying to access the internet and let's me block it or let it
go. Is it possible that ZA is blocking not my request to connect to the smtp
server but the server's reply?
On 4/19/07, Christopher Schultz <ch...@christopherschultz.net> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> MT,
>
> Mighty Tornado wrote:
> > It was churning for a long time and still didn't manage to send the
> email.
> > But it left me this exception:
>
> [snip]
>
> > Caused by: javax.mail.MessagingException: Could not connect to SMTP
> host:
> > smtp.gmail.com, port: 465, response: -1
>
> - From the command-line on your server, can you telnet to
> smtp.gmail.com:465? I'm wondering if you have a firewall that won't
> allow you to make that connection.
>
> >>> I heeded your advice and tried setting up Outlook Express for gmail
> >>> server.
> >>> This is the message that I got:
> >>> The connection to the server has failed. Account: 'smtp.google.com',
> >>> Server:
> >>> 'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket
> >>> Error:
> >>> 10060, Error Number: 0x800CCC0E
>
> So, it looks like this isn't a problem specific to Java. I'm guessing
> that you are being blocked somewhere. Microsoft Windows versions since
> 2000 (at least) have had software firewalls built into them that you can
> easily configure. You may also have another firewall on your network
> between you and google's SMTP server. If that's the case, you'll have to
> change the configuration of the firewall(s) to allow communication.
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGJ2z19CaO5/Lv0PARAhw7AJ0eEUTkWPr0SJkAOysnoUHAWqb7FACeItA9
> Z2wwl1/F8zG5/ahCnAdNIMY=
> =1Ll0
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: sending smtp mail failure
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
MT,
Mighty Tornado wrote:
> It was churning for a long time and still didn't manage to send the email.
> But it left me this exception:
[snip]
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host:
> smtp.gmail.com, port: 465, response: -1
- From the command-line on your server, can you telnet to
smtp.gmail.com:465? I'm wondering if you have a firewall that won't
allow you to make that connection.
>>> I heeded your advice and tried setting up Outlook Express for gmail
>>> server.
>>> This is the message that I got:
>>> The connection to the server has failed. Account: 'smtp.google.com',
>>> Server:
>>> 'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket
>>> Error:
>>> 10060, Error Number: 0x800CCC0E
So, it looks like this isn't a problem specific to Java. I'm guessing
that you are being blocked somewhere. Microsoft Windows versions since
2000 (at least) have had software firewalls built into them that you can
easily configure. You may also have another firewall on your network
between you and google's SMTP server. If that's the case, you'll have to
change the configuration of the firewall(s) to allow communication.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGJ2z19CaO5/Lv0PARAhw7AJ0eEUTkWPr0SJkAOysnoUHAWqb7FACeItA9
Z2wwl1/F8zG5/ahCnAdNIMY=
=1Ll0
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: sending smtp mail failure
Posted by Mighty Tornado <mi...@gmail.com>.
It was churning for a long time and still didn't manage to send the email.
But it left me this exception:
org.apache.commons.mail.EmailException: Sending the email to the following
serve
r failed : smtp.gmail.com:465
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:873)
at org.apache.commons.mail.Email.send(Email.java:898)
at TimeTravelMailer.sendMessage(TimeTravelMailer.java:29)
at CreateAccountServlet.doPost(CreateAccountServlet.java:12)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperV
alve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextV
alve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.j
ava:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.j
ava:117)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineVal
ve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.jav
a:151)
at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java
:870)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket
(PoolTcpEndpo
int.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt
(LeaderFol
lowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadP
ool.java:685)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host:
smtp.g
mail.com, port: 465, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java
:1270)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(
SMTPTransport.java:37
0)
at javax.mail.Service.connect(Service.java:297)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:863)
... 19 more
On 4/17/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
> Ha ha.... now you need to read up on threads and background processing
> Very good description in the java tutorial from sun.
>
> The browser will wait.... so u need to start the email as a background
> process.
> The browser will come back instantly, and depending on what u doing, you
> will have to log the error messages, and possibly allow the user to see a
> report via the browser.
>
> enjoy
>
>
> ----- Original Message -----
> From: "Mighty Tornado" <mi...@gmail.com>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Tuesday, April 17, 2007 2:35 AM
> Subject: Re: sending smtp mail failure
>
>
> > Thanks for the input,
> >
> > I was able to actually send email from Outlook Express after changing
> port
> > numbers and changing the host name to smtp.gmail.com instead of
> > smtp.google.com.
> >
> > Now I encountered a different problem - when I attempt to send an email
> > from
> > a servlet running on my local XP machine it looks like it is doing
> > something
> > but the green bar in the browser doesn't progress, it is there but stays
> > white. And no exceptions thrown. Just sitting there not proceeding to
> the
> > next page. Like it is trying to send an email but it is taking a year.
> >
> > On 4/16/07, Len Popp <le...@gmail.com> wrote:
> >>
> >> That's a timeout error. I was able to send an email thru
> >> smtp.google.com using Outlook Express, with no timeout error, so it
> >> looks like there's something wrong with either your email settings or
> >> your connection to gmail.com (firewall or something).
> >>
> >> Google has a troubleshooter program to diagnose POP & SMTP setup
> >> problems:
> >> http://mail.google.com/support/bin/answer.py?answer=44769
> >> --
> >> Len
> >>
> >> On 4/16/07, Mighty Tornado <mi...@gmail.com> wrote:
> >> > I heeded your advice and tried setting up Outlook Express for gmail
> >> server.
> >> > This is the message that I got:
> >> > The connection to the server has failed. Account: 'smtp.google.com',
> >> Server:
> >> > 'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket
> >> Error:
> >> > 10060, Error Number: 0x800CCC0E
> >> >
> >> > On 4/15/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
> >> > >
> >> > >
> >> > > Here is a little framework that u can play with
> >> > >
> >> > > MimeMessage msg = new MimeMessage(session);
> >> > > msg.setFrom(new InternetAddress(from));
> >> > > msg.addRecipient(Message.RecipientType.TO, new
> >> > > InternetAddress(to));
> >> > > msg.setSubject(subject);
> >> > > msg.setSentDate(new Date());
> >> > >
> >> > > // ADD TEXT
> >> > > MimeBodyPart mbp1 = new MimeBodyPart();
> >> > > mbp1.setText(sMessage);
> >> > >
> >> > > //ADD ATTACHEMENT
> >> > > MimeBodyPart mbp2 = new MimeBodyPart();
> >> > > if (sFilename.length() > 0){
> >> > > mbp2.setFileName(sFilename);
> >> > > mbp2.setText(sAttachment, "us-ascii");
> >> > > }
> >> > >
> >> > > // JOIN THEM
> >> > > Multipart mp = new MimeMultipart();
> >> > > mp.addBodyPart(mbp1);
> >> > > if (sFilename.length() > 0) mp.addBodyPart(mbp2);
> >> > >
> >> > > // ADD and SEND
> >> > > msg.setContent(mp);
> >> > > Transport.send(msg);
> >> > >
> >> > >
> >> > > Have fun
> >> > >
> >> > > ----- Original Message -----
> >> > > From: "Mighty Tornado" <mi...@gmail.com>
> >> > > To: "Tomcat Users List" <us...@tomcat.apache.org>
> >> > > Sent: Sunday, April 15, 2007 2:32 AM
> >> > > Subject: Re: sending smtp mail failure
> >> > >
> >> > >
> >> > > > Thanks for responding,
> >> > > >
> >> > > > there something wrong with my code?
> >> > > > This is my code:
> >> > > >
> >> > > > import java.util.*;
> >> > > > import java.io.*;
> >> > > > import javax.mail.*;
> >> > > > import javax.mail.internet.*;
> >> > > > import javax.activation.*;
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > public class TimeTravelMailer
> >> > > > {
> >> > > > public void sendMessage()
> >> > > > {
> >> > > > String to = "vilensky@gmail.com";
> >> > > > String from = "mighty.tornado@gmail.com";
> >> > > > String host = "smtp.google.com";
> >> > > > String message = "This is a test";
> >> > > >
> >> > > > Properties props = new Properties();
> >> > > >
> >> > > > props.put("mail.smtp.host", host);
> >> > > >
> >> > > > Session session = Session.getInstance(props);
> >> > > >
> >> > > > try
> >> > > > {
> >> > > > Transport bus = session.getTransport("smtp");
> >> > > >
> >> > > > bus.connect(host, "mighty.tornado@gmail.com", "
> >> amb38914041@2
> >> > > ");
> >> > > >
> >> > > > Message msg = new MimeMessage(session);
> >> > > >
> >> > > > msg.setFrom(new InternetAddress(from));
> >> > > >
> >> > > > InternetAddress[] address = {new InternetAddress(to)};
> >> > > >
> >> > > > msg.setRecipients(Message.RecipientType.TO, address);
> >> > > >
> >> > > > msg.setRecipients(Message.RecipientType.CC,
> >> > > > InternetAddress.parse(to, true));
> >> > > >
> >> > > > msg.setRecipients(Message.RecipientType.BCC,
> >> > > > InternetAddress.parse(to, false));
> >> > > >
> >> > > > msg.setSubject("Test E-Mail through Java");
> >> > > >
> >> > > > msg.setSentDate(new Date());
> >> > > >
> >> > > > msg.setText(message);
> >> > > >
> >> > > > msg.saveChanges();
> >> > > >
> >> > > > bus.sendMessage(msg, address);
> >> > > >
> >> > > > bus.close();
> >> > > > }
> >> > > > catch(Exception ex)
> >> > > > {
> >> > > > ex.printStackTrace();
> >> > > > }
> >> > > > }
> >> > > > }
> >> > > >
> >> > > > On 4/7/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
> >> > > >>
> >> > > >>
> >> > > >> Easiest way is to setup a normal email program and see what the
> >> error
> >> > > >> messages are.
> >> > > >> If the machine doesnt have core mailing engines installed, it
> will
> >> > > >> probably
> >> > > >> tell you.
> >> > > >> If you on windows, try Outlook express, detailed messages will
> >> probably
> >> > > >> point you in right direction.
> >> > > >>
> >> > > >> Code should look something like this
> >> > > >>
> >> > > >>
> >> > > >> public boolean prepareConnection(String smtpHost){
> >> > > >> this.smtpHost = smtpHost;
> >> > > >> fSessionInited = true;
> >> > > >>
> >> > > >> try{
> >> > > >> java.util.Properties properties = System.getProperties
> ();
> >> > > >> properties.put("mail.smtp.host", smtpHost);
> >> > > >> session = Session.getInstance(properties,null);
> >> > > >> } catch(Exception e) {
> >> > > >> fSessionInited = false;
> >> > > >> }
> >> > > >>
> >> > > >> return fSessionInited;
> >> > > >> }
> >> > > >>
> >> > > >>
> >> > > >>
> >> > > >>
> >> > > >> ----- Original Message -----
> >> > > >> From: "Mighty Tornado" <mi...@gmail.com>
> >> > > >> To: <us...@tomcat.apache.org>
> >> > > >> Sent: Friday, April 06, 2007 7:30 AM
> >> > > >> Subject: sending smtp mail failure
> >> > > >>
> >> > > >>
> >> > > >> > Hi,
> >> > > >> >
> >> > > >> > I set up a small web app and the servlet is supposed to send
> an
> >> email
> >> > > >> > using
> >> > > >> > JavaMail. But I am getting exceptions - Connection Timed out
> >> every
> >> > > >> > time.
> >> > > >> I
> >> > > >> > am using Gmail as an smtp server to bounce emails off. How can
> I
> >> > > avoid
> >> > > >> the
> >> > > >> > Connection Timed out exception? Could it be because of my
> >> firewall?
> >> > > If
> >> > > >> so,
> >> > > >> > which process should I permission?
> >> > > >> >
> >> > > >> > Thank you,
> >> > > >> >
> >> > > >> > MT
> >> > > >> >
> >> > > >>
> >> > > >>
> >> > > >>
> >> ---------------------------------------------------------------------
> >> > > >> To start a new topic, e-mail: users@tomcat.apache.org
> >> > > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> > > >> For additional commands, e-mail: users-help@tomcat.apache.org
> >> > > >>
> >> > > >>
> >> > > >
> >> > >
> >> > >
> >> > >
> ---------------------------------------------------------------------
> >> > > To start a new topic, e-mail: users@tomcat.apache.org
> >> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> > > For additional commands, e-mail: users-help@tomcat.apache.org
> >> > >
> >> > >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To start a new topic, e-mail: users@tomcat.apache.org
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: sending smtp mail failure
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Ha ha.... now you need to read up on threads and background processing
Very good description in the java tutorial from sun.
The browser will wait.... so u need to start the email as a background
process.
The browser will come back instantly, and depending on what u doing, you
will have to log the error messages, and possibly allow the user to see a
report via the browser.
enjoy
----- Original Message -----
From: "Mighty Tornado" <mi...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, April 17, 2007 2:35 AM
Subject: Re: sending smtp mail failure
> Thanks for the input,
>
> I was able to actually send email from Outlook Express after changing port
> numbers and changing the host name to smtp.gmail.com instead of
> smtp.google.com.
>
> Now I encountered a different problem - when I attempt to send an email
> from
> a servlet running on my local XP machine it looks like it is doing
> something
> but the green bar in the browser doesn't progress, it is there but stays
> white. And no exceptions thrown. Just sitting there not proceeding to the
> next page. Like it is trying to send an email but it is taking a year.
>
> On 4/16/07, Len Popp <le...@gmail.com> wrote:
>>
>> That's a timeout error. I was able to send an email thru
>> smtp.google.com using Outlook Express, with no timeout error, so it
>> looks like there's something wrong with either your email settings or
>> your connection to gmail.com (firewall or something).
>>
>> Google has a troubleshooter program to diagnose POP & SMTP setup
>> problems:
>> http://mail.google.com/support/bin/answer.py?answer=44769
>> --
>> Len
>>
>> On 4/16/07, Mighty Tornado <mi...@gmail.com> wrote:
>> > I heeded your advice and tried setting up Outlook Express for gmail
>> server.
>> > This is the message that I got:
>> > The connection to the server has failed. Account: 'smtp.google.com',
>> Server:
>> > 'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket
>> Error:
>> > 10060, Error Number: 0x800CCC0E
>> >
>> > On 4/15/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>> > >
>> > >
>> > > Here is a little framework that u can play with
>> > >
>> > > MimeMessage msg = new MimeMessage(session);
>> > > msg.setFrom(new InternetAddress(from));
>> > > msg.addRecipient(Message.RecipientType.TO, new
>> > > InternetAddress(to));
>> > > msg.setSubject(subject);
>> > > msg.setSentDate(new Date());
>> > >
>> > > // ADD TEXT
>> > > MimeBodyPart mbp1 = new MimeBodyPart();
>> > > mbp1.setText(sMessage);
>> > >
>> > > //ADD ATTACHEMENT
>> > > MimeBodyPart mbp2 = new MimeBodyPart();
>> > > if (sFilename.length() > 0){
>> > > mbp2.setFileName(sFilename);
>> > > mbp2.setText(sAttachment, "us-ascii");
>> > > }
>> > >
>> > > // JOIN THEM
>> > > Multipart mp = new MimeMultipart();
>> > > mp.addBodyPart(mbp1);
>> > > if (sFilename.length() > 0) mp.addBodyPart(mbp2);
>> > >
>> > > // ADD and SEND
>> > > msg.setContent(mp);
>> > > Transport.send(msg);
>> > >
>> > >
>> > > Have fun
>> > >
>> > > ----- Original Message -----
>> > > From: "Mighty Tornado" <mi...@gmail.com>
>> > > To: "Tomcat Users List" <us...@tomcat.apache.org>
>> > > Sent: Sunday, April 15, 2007 2:32 AM
>> > > Subject: Re: sending smtp mail failure
>> > >
>> > >
>> > > > Thanks for responding,
>> > > >
>> > > > there something wrong with my code?
>> > > > This is my code:
>> > > >
>> > > > import java.util.*;
>> > > > import java.io.*;
>> > > > import javax.mail.*;
>> > > > import javax.mail.internet.*;
>> > > > import javax.activation.*;
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > public class TimeTravelMailer
>> > > > {
>> > > > public void sendMessage()
>> > > > {
>> > > > String to = "vilensky@gmail.com";
>> > > > String from = "mighty.tornado@gmail.com";
>> > > > String host = "smtp.google.com";
>> > > > String message = "This is a test";
>> > > >
>> > > > Properties props = new Properties();
>> > > >
>> > > > props.put("mail.smtp.host", host);
>> > > >
>> > > > Session session = Session.getInstance(props);
>> > > >
>> > > > try
>> > > > {
>> > > > Transport bus = session.getTransport("smtp");
>> > > >
>> > > > bus.connect(host, "mighty.tornado@gmail.com", "
>> amb38914041@2
>> > > ");
>> > > >
>> > > > Message msg = new MimeMessage(session);
>> > > >
>> > > > msg.setFrom(new InternetAddress(from));
>> > > >
>> > > > InternetAddress[] address = {new InternetAddress(to)};
>> > > >
>> > > > msg.setRecipients(Message.RecipientType.TO, address);
>> > > >
>> > > > msg.setRecipients(Message.RecipientType.CC,
>> > > > InternetAddress.parse(to, true));
>> > > >
>> > > > msg.setRecipients(Message.RecipientType.BCC,
>> > > > InternetAddress.parse(to, false));
>> > > >
>> > > > msg.setSubject("Test E-Mail through Java");
>> > > >
>> > > > msg.setSentDate(new Date());
>> > > >
>> > > > msg.setText(message);
>> > > >
>> > > > msg.saveChanges();
>> > > >
>> > > > bus.sendMessage(msg, address);
>> > > >
>> > > > bus.close();
>> > > > }
>> > > > catch(Exception ex)
>> > > > {
>> > > > ex.printStackTrace();
>> > > > }
>> > > > }
>> > > > }
>> > > >
>> > > > On 4/7/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>> > > >>
>> > > >>
>> > > >> Easiest way is to setup a normal email program and see what the
>> error
>> > > >> messages are.
>> > > >> If the machine doesnt have core mailing engines installed, it will
>> > > >> probably
>> > > >> tell you.
>> > > >> If you on windows, try Outlook express, detailed messages will
>> probably
>> > > >> point you in right direction.
>> > > >>
>> > > >> Code should look something like this
>> > > >>
>> > > >>
>> > > >> public boolean prepareConnection(String smtpHost){
>> > > >> this.smtpHost = smtpHost;
>> > > >> fSessionInited = true;
>> > > >>
>> > > >> try{
>> > > >> java.util.Properties properties = System.getProperties();
>> > > >> properties.put("mail.smtp.host", smtpHost);
>> > > >> session = Session.getInstance(properties,null);
>> > > >> } catch(Exception e) {
>> > > >> fSessionInited = false;
>> > > >> }
>> > > >>
>> > > >> return fSessionInited;
>> > > >> }
>> > > >>
>> > > >>
>> > > >>
>> > > >>
>> > > >> ----- Original Message -----
>> > > >> From: "Mighty Tornado" <mi...@gmail.com>
>> > > >> To: <us...@tomcat.apache.org>
>> > > >> Sent: Friday, April 06, 2007 7:30 AM
>> > > >> Subject: sending smtp mail failure
>> > > >>
>> > > >>
>> > > >> > Hi,
>> > > >> >
>> > > >> > I set up a small web app and the servlet is supposed to send an
>> email
>> > > >> > using
>> > > >> > JavaMail. But I am getting exceptions - Connection Timed out
>> every
>> > > >> > time.
>> > > >> I
>> > > >> > am using Gmail as an smtp server to bounce emails off. How can I
>> > > avoid
>> > > >> the
>> > > >> > Connection Timed out exception? Could it be because of my
>> firewall?
>> > > If
>> > > >> so,
>> > > >> > which process should I permission?
>> > > >> >
>> > > >> > Thank you,
>> > > >> >
>> > > >> > MT
>> > > >> >
>> > > >>
>> > > >>
>> > > >>
>> ---------------------------------------------------------------------
>> > > >> To start a new topic, e-mail: users@tomcat.apache.org
>> > > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > > >> For additional commands, e-mail: users-help@tomcat.apache.org
>> > > >>
>> > > >>
>> > > >
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To start a new topic, e-mail: users@tomcat.apache.org
>> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > > For additional commands, e-mail: users-help@tomcat.apache.org
>> > >
>> > >
>> >
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: sending smtp mail failure
Posted by Mighty Tornado <mi...@gmail.com>.
Thanks for the input,
I was able to actually send email from Outlook Express after changing port
numbers and changing the host name to smtp.gmail.com instead of
smtp.google.com.
Now I encountered a different problem - when I attempt to send an email from
a servlet running on my local XP machine it looks like it is doing something
but the green bar in the browser doesn't progress, it is there but stays
white. And no exceptions thrown. Just sitting there not proceeding to the
next page. Like it is trying to send an email but it is taking a year.
On 4/16/07, Len Popp <le...@gmail.com> wrote:
>
> That's a timeout error. I was able to send an email thru
> smtp.google.com using Outlook Express, with no timeout error, so it
> looks like there's something wrong with either your email settings or
> your connection to gmail.com (firewall or something).
>
> Google has a troubleshooter program to diagnose POP & SMTP setup problems:
> http://mail.google.com/support/bin/answer.py?answer=44769
> --
> Len
>
> On 4/16/07, Mighty Tornado <mi...@gmail.com> wrote:
> > I heeded your advice and tried setting up Outlook Express for gmail
> server.
> > This is the message that I got:
> > The connection to the server has failed. Account: 'smtp.google.com',
> Server:
> > 'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket
> Error:
> > 10060, Error Number: 0x800CCC0E
> >
> > On 4/15/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
> > >
> > >
> > > Here is a little framework that u can play with
> > >
> > > MimeMessage msg = new MimeMessage(session);
> > > msg.setFrom(new InternetAddress(from));
> > > msg.addRecipient(Message.RecipientType.TO, new
> > > InternetAddress(to));
> > > msg.setSubject(subject);
> > > msg.setSentDate(new Date());
> > >
> > > // ADD TEXT
> > > MimeBodyPart mbp1 = new MimeBodyPart();
> > > mbp1.setText(sMessage);
> > >
> > > //ADD ATTACHEMENT
> > > MimeBodyPart mbp2 = new MimeBodyPart();
> > > if (sFilename.length() > 0){
> > > mbp2.setFileName(sFilename);
> > > mbp2.setText(sAttachment, "us-ascii");
> > > }
> > >
> > > // JOIN THEM
> > > Multipart mp = new MimeMultipart();
> > > mp.addBodyPart(mbp1);
> > > if (sFilename.length() > 0) mp.addBodyPart(mbp2);
> > >
> > > // ADD and SEND
> > > msg.setContent(mp);
> > > Transport.send(msg);
> > >
> > >
> > > Have fun
> > >
> > > ----- Original Message -----
> > > From: "Mighty Tornado" <mi...@gmail.com>
> > > To: "Tomcat Users List" <us...@tomcat.apache.org>
> > > Sent: Sunday, April 15, 2007 2:32 AM
> > > Subject: Re: sending smtp mail failure
> > >
> > >
> > > > Thanks for responding,
> > > >
> > > > there something wrong with my code?
> > > > This is my code:
> > > >
> > > > import java.util.*;
> > > > import java.io.*;
> > > > import javax.mail.*;
> > > > import javax.mail.internet.*;
> > > > import javax.activation.*;
> > > >
> > > >
> > > >
> > > >
> > > > public class TimeTravelMailer
> > > > {
> > > > public void sendMessage()
> > > > {
> > > > String to = "vilensky@gmail.com";
> > > > String from = "mighty.tornado@gmail.com";
> > > > String host = "smtp.google.com";
> > > > String message = "This is a test";
> > > >
> > > > Properties props = new Properties();
> > > >
> > > > props.put("mail.smtp.host", host);
> > > >
> > > > Session session = Session.getInstance(props);
> > > >
> > > > try
> > > > {
> > > > Transport bus = session.getTransport("smtp");
> > > >
> > > > bus.connect(host, "mighty.tornado@gmail.com", "
> amb38914041@2
> > > ");
> > > >
> > > > Message msg = new MimeMessage(session);
> > > >
> > > > msg.setFrom(new InternetAddress(from));
> > > >
> > > > InternetAddress[] address = {new InternetAddress(to)};
> > > >
> > > > msg.setRecipients(Message.RecipientType.TO, address);
> > > >
> > > > msg.setRecipients(Message.RecipientType.CC,
> > > > InternetAddress.parse(to, true));
> > > >
> > > > msg.setRecipients(Message.RecipientType.BCC,
> > > > InternetAddress.parse(to, false));
> > > >
> > > > msg.setSubject("Test E-Mail through Java");
> > > >
> > > > msg.setSentDate(new Date());
> > > >
> > > > msg.setText(message);
> > > >
> > > > msg.saveChanges();
> > > >
> > > > bus.sendMessage(msg, address);
> > > >
> > > > bus.close();
> > > > }
> > > > catch(Exception ex)
> > > > {
> > > > ex.printStackTrace();
> > > > }
> > > > }
> > > > }
> > > >
> > > > On 4/7/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
> > > >>
> > > >>
> > > >> Easiest way is to setup a normal email program and see what the
> error
> > > >> messages are.
> > > >> If the machine doesnt have core mailing engines installed, it will
> > > >> probably
> > > >> tell you.
> > > >> If you on windows, try Outlook express, detailed messages will
> probably
> > > >> point you in right direction.
> > > >>
> > > >> Code should look something like this
> > > >>
> > > >>
> > > >> public boolean prepareConnection(String smtpHost){
> > > >> this.smtpHost = smtpHost;
> > > >> fSessionInited = true;
> > > >>
> > > >> try{
> > > >> java.util.Properties properties = System.getProperties();
> > > >> properties.put("mail.smtp.host", smtpHost);
> > > >> session = Session.getInstance(properties,null);
> > > >> } catch(Exception e) {
> > > >> fSessionInited = false;
> > > >> }
> > > >>
> > > >> return fSessionInited;
> > > >> }
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> ----- Original Message -----
> > > >> From: "Mighty Tornado" <mi...@gmail.com>
> > > >> To: <us...@tomcat.apache.org>
> > > >> Sent: Friday, April 06, 2007 7:30 AM
> > > >> Subject: sending smtp mail failure
> > > >>
> > > >>
> > > >> > Hi,
> > > >> >
> > > >> > I set up a small web app and the servlet is supposed to send an
> email
> > > >> > using
> > > >> > JavaMail. But I am getting exceptions - Connection Timed out
> every
> > > >> > time.
> > > >> I
> > > >> > am using Gmail as an smtp server to bounce emails off. How can I
> > > avoid
> > > >> the
> > > >> > Connection Timed out exception? Could it be because of my
> firewall?
> > > If
> > > >> so,
> > > >> > which process should I permission?
> > > >> >
> > > >> > Thank you,
> > > >> >
> > > >> > MT
> > > >> >
> > > >>
> > > >>
> > > >>
> ---------------------------------------------------------------------
> > > >> To start a new topic, e-mail: users@tomcat.apache.org
> > > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > >> For additional commands, e-mail: users-help@tomcat.apache.org
> > > >>
> > > >>
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: sending smtp mail failure
Posted by Len Popp <le...@gmail.com>.
That's a timeout error. I was able to send an email thru
smtp.google.com using Outlook Express, with no timeout error, so it
looks like there's something wrong with either your email settings or
your connection to gmail.com (firewall or something).
Google has a troubleshooter program to diagnose POP & SMTP setup problems:
http://mail.google.com/support/bin/answer.py?answer=44769
--
Len
On 4/16/07, Mighty Tornado <mi...@gmail.com> wrote:
> I heeded your advice and tried setting up Outlook Express for gmail server.
> This is the message that I got:
> The connection to the server has failed. Account: 'smtp.google.com', Server:
> 'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error:
> 10060, Error Number: 0x800CCC0E
>
> On 4/15/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
> >
> >
> > Here is a little framework that u can play with
> >
> > MimeMessage msg = new MimeMessage(session);
> > msg.setFrom(new InternetAddress(from));
> > msg.addRecipient(Message.RecipientType.TO, new
> > InternetAddress(to));
> > msg.setSubject(subject);
> > msg.setSentDate(new Date());
> >
> > // ADD TEXT
> > MimeBodyPart mbp1 = new MimeBodyPart();
> > mbp1.setText(sMessage);
> >
> > //ADD ATTACHEMENT
> > MimeBodyPart mbp2 = new MimeBodyPart();
> > if (sFilename.length() > 0){
> > mbp2.setFileName(sFilename);
> > mbp2.setText(sAttachment, "us-ascii");
> > }
> >
> > // JOIN THEM
> > Multipart mp = new MimeMultipart();
> > mp.addBodyPart(mbp1);
> > if (sFilename.length() > 0) mp.addBodyPart(mbp2);
> >
> > // ADD and SEND
> > msg.setContent(mp);
> > Transport.send(msg);
> >
> >
> > Have fun
> >
> > ----- Original Message -----
> > From: "Mighty Tornado" <mi...@gmail.com>
> > To: "Tomcat Users List" <us...@tomcat.apache.org>
> > Sent: Sunday, April 15, 2007 2:32 AM
> > Subject: Re: sending smtp mail failure
> >
> >
> > > Thanks for responding,
> > >
> > > there something wrong with my code?
> > > This is my code:
> > >
> > > import java.util.*;
> > > import java.io.*;
> > > import javax.mail.*;
> > > import javax.mail.internet.*;
> > > import javax.activation.*;
> > >
> > >
> > >
> > >
> > > public class TimeTravelMailer
> > > {
> > > public void sendMessage()
> > > {
> > > String to = "vilensky@gmail.com";
> > > String from = "mighty.tornado@gmail.com";
> > > String host = "smtp.google.com";
> > > String message = "This is a test";
> > >
> > > Properties props = new Properties();
> > >
> > > props.put("mail.smtp.host", host);
> > >
> > > Session session = Session.getInstance(props);
> > >
> > > try
> > > {
> > > Transport bus = session.getTransport("smtp");
> > >
> > > bus.connect(host, "mighty.tornado@gmail.com", "amb38914041@2
> > ");
> > >
> > > Message msg = new MimeMessage(session);
> > >
> > > msg.setFrom(new InternetAddress(from));
> > >
> > > InternetAddress[] address = {new InternetAddress(to)};
> > >
> > > msg.setRecipients(Message.RecipientType.TO, address);
> > >
> > > msg.setRecipients(Message.RecipientType.CC,
> > > InternetAddress.parse(to, true));
> > >
> > > msg.setRecipients(Message.RecipientType.BCC,
> > > InternetAddress.parse(to, false));
> > >
> > > msg.setSubject("Test E-Mail through Java");
> > >
> > > msg.setSentDate(new Date());
> > >
> > > msg.setText(message);
> > >
> > > msg.saveChanges();
> > >
> > > bus.sendMessage(msg, address);
> > >
> > > bus.close();
> > > }
> > > catch(Exception ex)
> > > {
> > > ex.printStackTrace();
> > > }
> > > }
> > > }
> > >
> > > On 4/7/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
> > >>
> > >>
> > >> Easiest way is to setup a normal email program and see what the error
> > >> messages are.
> > >> If the machine doesnt have core mailing engines installed, it will
> > >> probably
> > >> tell you.
> > >> If you on windows, try Outlook express, detailed messages will probably
> > >> point you in right direction.
> > >>
> > >> Code should look something like this
> > >>
> > >>
> > >> public boolean prepareConnection(String smtpHost){
> > >> this.smtpHost = smtpHost;
> > >> fSessionInited = true;
> > >>
> > >> try{
> > >> java.util.Properties properties = System.getProperties();
> > >> properties.put("mail.smtp.host", smtpHost);
> > >> session = Session.getInstance(properties,null);
> > >> } catch(Exception e) {
> > >> fSessionInited = false;
> > >> }
> > >>
> > >> return fSessionInited;
> > >> }
> > >>
> > >>
> > >>
> > >>
> > >> ----- Original Message -----
> > >> From: "Mighty Tornado" <mi...@gmail.com>
> > >> To: <us...@tomcat.apache.org>
> > >> Sent: Friday, April 06, 2007 7:30 AM
> > >> Subject: sending smtp mail failure
> > >>
> > >>
> > >> > Hi,
> > >> >
> > >> > I set up a small web app and the servlet is supposed to send an email
> > >> > using
> > >> > JavaMail. But I am getting exceptions - Connection Timed out every
> > >> > time.
> > >> I
> > >> > am using Gmail as an smtp server to bounce emails off. How can I
> > avoid
> > >> the
> > >> > Connection Timed out exception? Could it be because of my firewall?
> > If
> > >> so,
> > >> > which process should I permission?
> > >> >
> > >> > Thank you,
> > >> >
> > >> > MT
> > >> >
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To start a new topic, e-mail: users@tomcat.apache.org
> > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> For additional commands, e-mail: users-help@tomcat.apache.org
> > >>
> > >>
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: sending smtp mail failure
Posted by Mighty Tornado <mi...@gmail.com>.
I heeded your advice and tried setting up Outlook Express for gmail server.
This is the message that I got:
The connection to the server has failed. Account: 'smtp.google.com', Server:
'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error:
10060, Error Number: 0x800CCC0E
On 4/15/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
>
> Here is a little framework that u can play with
>
> MimeMessage msg = new MimeMessage(session);
> msg.setFrom(new InternetAddress(from));
> msg.addRecipient(Message.RecipientType.TO, new
> InternetAddress(to));
> msg.setSubject(subject);
> msg.setSentDate(new Date());
>
> // ADD TEXT
> MimeBodyPart mbp1 = new MimeBodyPart();
> mbp1.setText(sMessage);
>
> //ADD ATTACHEMENT
> MimeBodyPart mbp2 = new MimeBodyPart();
> if (sFilename.length() > 0){
> mbp2.setFileName(sFilename);
> mbp2.setText(sAttachment, "us-ascii");
> }
>
> // JOIN THEM
> Multipart mp = new MimeMultipart();
> mp.addBodyPart(mbp1);
> if (sFilename.length() > 0) mp.addBodyPart(mbp2);
>
> // ADD and SEND
> msg.setContent(mp);
> Transport.send(msg);
>
>
> Have fun
>
> ----- Original Message -----
> From: "Mighty Tornado" <mi...@gmail.com>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Sunday, April 15, 2007 2:32 AM
> Subject: Re: sending smtp mail failure
>
>
> > Thanks for responding,
> >
> > there something wrong with my code?
> > This is my code:
> >
> > import java.util.*;
> > import java.io.*;
> > import javax.mail.*;
> > import javax.mail.internet.*;
> > import javax.activation.*;
> >
> >
> >
> >
> > public class TimeTravelMailer
> > {
> > public void sendMessage()
> > {
> > String to = "vilensky@gmail.com";
> > String from = "mighty.tornado@gmail.com";
> > String host = "smtp.google.com";
> > String message = "This is a test";
> >
> > Properties props = new Properties();
> >
> > props.put("mail.smtp.host", host);
> >
> > Session session = Session.getInstance(props);
> >
> > try
> > {
> > Transport bus = session.getTransport("smtp");
> >
> > bus.connect(host, "mighty.tornado@gmail.com", "amb38914041@2
> ");
> >
> > Message msg = new MimeMessage(session);
> >
> > msg.setFrom(new InternetAddress(from));
> >
> > InternetAddress[] address = {new InternetAddress(to)};
> >
> > msg.setRecipients(Message.RecipientType.TO, address);
> >
> > msg.setRecipients(Message.RecipientType.CC,
> > InternetAddress.parse(to, true));
> >
> > msg.setRecipients(Message.RecipientType.BCC,
> > InternetAddress.parse(to, false));
> >
> > msg.setSubject("Test E-Mail through Java");
> >
> > msg.setSentDate(new Date());
> >
> > msg.setText(message);
> >
> > msg.saveChanges();
> >
> > bus.sendMessage(msg, address);
> >
> > bus.close();
> > }
> > catch(Exception ex)
> > {
> > ex.printStackTrace();
> > }
> > }
> > }
> >
> > On 4/7/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
> >>
> >>
> >> Easiest way is to setup a normal email program and see what the error
> >> messages are.
> >> If the machine doesnt have core mailing engines installed, it will
> >> probably
> >> tell you.
> >> If you on windows, try Outlook express, detailed messages will probably
> >> point you in right direction.
> >>
> >> Code should look something like this
> >>
> >>
> >> public boolean prepareConnection(String smtpHost){
> >> this.smtpHost = smtpHost;
> >> fSessionInited = true;
> >>
> >> try{
> >> java.util.Properties properties = System.getProperties();
> >> properties.put("mail.smtp.host", smtpHost);
> >> session = Session.getInstance(properties,null);
> >> } catch(Exception e) {
> >> fSessionInited = false;
> >> }
> >>
> >> return fSessionInited;
> >> }
> >>
> >>
> >>
> >>
> >> ----- Original Message -----
> >> From: "Mighty Tornado" <mi...@gmail.com>
> >> To: <us...@tomcat.apache.org>
> >> Sent: Friday, April 06, 2007 7:30 AM
> >> Subject: sending smtp mail failure
> >>
> >>
> >> > Hi,
> >> >
> >> > I set up a small web app and the servlet is supposed to send an email
> >> > using
> >> > JavaMail. But I am getting exceptions - Connection Timed out every
> >> > time.
> >> I
> >> > am using Gmail as an smtp server to bounce emails off. How can I
> avoid
> >> the
> >> > Connection Timed out exception? Could it be because of my firewall?
> If
> >> so,
> >> > which process should I permission?
> >> >
> >> > Thank you,
> >> >
> >> > MT
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To start a new topic, e-mail: users@tomcat.apache.org
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: sending smtp mail failure
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Here is a little framework that u can play with
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
msg.setSentDate(new Date());
// ADD TEXT
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(sMessage);
//ADD ATTACHEMENT
MimeBodyPart mbp2 = new MimeBodyPart();
if (sFilename.length() > 0){
mbp2.setFileName(sFilename);
mbp2.setText(sAttachment, "us-ascii");
}
// JOIN THEM
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
if (sFilename.length() > 0) mp.addBodyPart(mbp2);
// ADD and SEND
msg.setContent(mp);
Transport.send(msg);
Have fun
----- Original Message -----
From: "Mighty Tornado" <mi...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Sunday, April 15, 2007 2:32 AM
Subject: Re: sending smtp mail failure
> Thanks for responding,
>
> there something wrong with my code?
> This is my code:
>
> import java.util.*;
> import java.io.*;
> import javax.mail.*;
> import javax.mail.internet.*;
> import javax.activation.*;
>
>
>
>
> public class TimeTravelMailer
> {
> public void sendMessage()
> {
> String to = "vilensky@gmail.com";
> String from = "mighty.tornado@gmail.com";
> String host = "smtp.google.com";
> String message = "This is a test";
>
> Properties props = new Properties();
>
> props.put("mail.smtp.host", host);
>
> Session session = Session.getInstance(props);
>
> try
> {
> Transport bus = session.getTransport("smtp");
>
> bus.connect(host, "mighty.tornado@gmail.com", "amb38914041@2");
>
> Message msg = new MimeMessage(session);
>
> msg.setFrom(new InternetAddress(from));
>
> InternetAddress[] address = {new InternetAddress(to)};
>
> msg.setRecipients(Message.RecipientType.TO, address);
>
> msg.setRecipients(Message.RecipientType.CC,
> InternetAddress.parse(to, true));
>
> msg.setRecipients(Message.RecipientType.BCC,
> InternetAddress.parse(to, false));
>
> msg.setSubject("Test E-Mail through Java");
>
> msg.setSentDate(new Date());
>
> msg.setText(message);
>
> msg.saveChanges();
>
> bus.sendMessage(msg, address);
>
> bus.close();
> }
> catch(Exception ex)
> {
> ex.printStackTrace();
> }
> }
> }
>
> On 4/7/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>>
>>
>> Easiest way is to setup a normal email program and see what the error
>> messages are.
>> If the machine doesnt have core mailing engines installed, it will
>> probably
>> tell you.
>> If you on windows, try Outlook express, detailed messages will probably
>> point you in right direction.
>>
>> Code should look something like this
>>
>>
>> public boolean prepareConnection(String smtpHost){
>> this.smtpHost = smtpHost;
>> fSessionInited = true;
>>
>> try{
>> java.util.Properties properties = System.getProperties();
>> properties.put("mail.smtp.host", smtpHost);
>> session = Session.getInstance(properties,null);
>> } catch(Exception e) {
>> fSessionInited = false;
>> }
>>
>> return fSessionInited;
>> }
>>
>>
>>
>>
>> ----- Original Message -----
>> From: "Mighty Tornado" <mi...@gmail.com>
>> To: <us...@tomcat.apache.org>
>> Sent: Friday, April 06, 2007 7:30 AM
>> Subject: sending smtp mail failure
>>
>>
>> > Hi,
>> >
>> > I set up a small web app and the servlet is supposed to send an email
>> > using
>> > JavaMail. But I am getting exceptions - Connection Timed out every
>> > time.
>> I
>> > am using Gmail as an smtp server to bounce emails off. How can I avoid
>> the
>> > Connection Timed out exception? Could it be because of my firewall? If
>> so,
>> > which process should I permission?
>> >
>> > Thank you,
>> >
>> > MT
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: sending smtp mail failure
Posted by Mighty Tornado <mi...@gmail.com>.
Thanks for responding,
there something wrong with my code?
This is my code:
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class TimeTravelMailer
{
public void sendMessage()
{
String to = "vilensky@gmail.com";
String from = "mighty.tornado@gmail.com";
String host = "smtp.google.com";
String message = "This is a test";
Properties props = new Properties();
props.put("mail.smtp.host", host);
Session session = Session.getInstance(props);
try
{
Transport bus = session.getTransport("smtp");
bus.connect(host, "mighty.tornado@gmail.com", "amb38914041@2");
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(to, true));
msg.setRecipients(Message.RecipientType.BCC,
InternetAddress.parse(to, false));
msg.setSubject("Test E-Mail through Java");
msg.setSentDate(new Date());
msg.setText(message);
msg.saveChanges();
bus.sendMessage(msg, address);
bus.close();
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
On 4/7/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
>
> Easiest way is to setup a normal email program and see what the error
> messages are.
> If the machine doesnt have core mailing engines installed, it will
> probably
> tell you.
> If you on windows, try Outlook express, detailed messages will probably
> point you in right direction.
>
> Code should look something like this
>
>
> public boolean prepareConnection(String smtpHost){
> this.smtpHost = smtpHost;
> fSessionInited = true;
>
> try{
> java.util.Properties properties = System.getProperties();
> properties.put("mail.smtp.host", smtpHost);
> session = Session.getInstance(properties,null);
> } catch(Exception e) {
> fSessionInited = false;
> }
>
> return fSessionInited;
> }
>
>
>
>
> ----- Original Message -----
> From: "Mighty Tornado" <mi...@gmail.com>
> To: <us...@tomcat.apache.org>
> Sent: Friday, April 06, 2007 7:30 AM
> Subject: sending smtp mail failure
>
>
> > Hi,
> >
> > I set up a small web app and the servlet is supposed to send an email
> > using
> > JavaMail. But I am getting exceptions - Connection Timed out every time.
> I
> > am using Gmail as an smtp server to bounce emails off. How can I avoid
> the
> > Connection Timed out exception? Could it be because of my firewall? If
> so,
> > which process should I permission?
> >
> > Thank you,
> >
> > MT
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: sending smtp mail failure
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Easiest way is to setup a normal email program and see what the error
messages are.
If the machine doesnt have core mailing engines installed, it will probably
tell you.
If you on windows, try Outlook express, detailed messages will probably
point you in right direction.
Code should look something like this
public boolean prepareConnection(String smtpHost){
this.smtpHost = smtpHost;
fSessionInited = true;
try{
java.util.Properties properties = System.getProperties();
properties.put("mail.smtp.host", smtpHost);
session = Session.getInstance(properties,null);
} catch(Exception e) {
fSessionInited = false;
}
return fSessionInited;
}
----- Original Message -----
From: "Mighty Tornado" <mi...@gmail.com>
To: <us...@tomcat.apache.org>
Sent: Friday, April 06, 2007 7:30 AM
Subject: sending smtp mail failure
> Hi,
>
> I set up a small web app and the servlet is supposed to send an email
> using
> JavaMail. But I am getting exceptions - Connection Timed out every time. I
> am using Gmail as an smtp server to bounce emails off. How can I avoid the
> Connection Timed out exception? Could it be because of my firewall? If so,
> which process should I permission?
>
> Thank you,
>
> MT
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org