Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Making JavaMail work

Reply
Thread Tools

Making JavaMail work

 
 
Paul Cager
Guest
Posts: n/a
 
      06-09-2010
On Jun 8, 11:58*pm, jesbox <(E-Mail Removed)> wrote:
> Thanks for the tips. I have changed into hard-coded values, i.e.
> * *System.setProperty("mail.smtps.auth", "true"); // enable https
> * *new Mailer("smtp.gmail.com", 465, "(E-Mail Removed)",
> "a_password").sendMail(email);


Sorry if this is a silly question, but are the username and password
above just dummies because you (wisely) don't want to publish your
real user/password on usenet? You _are_ passing in your own real Gmail
user-id and password when you run your program?
 
Reply With Quote
 
 
 
 
jesbox
Guest
Posts: n/a
 
      06-09-2010
On Jun 9, 12:48*pm, Paul Cager <(E-Mail Removed)> wrote:
> On Jun 8, 11:58*pm, jesbox <(E-Mail Removed)> wrote:
>
> > Thanks for the tips. I have changed into hard-coded values, i.e.
> > * *System.setProperty("mail.smtps.auth", "true"); // enable https
> > * *new Mailer("smtp.gmail.com", 465, "(E-Mail Removed)",
> > "a_password").sendMail(email);

>
> Sorry if this is a silly question, but are the username and password
> above just dummies because you (wisely) don't want to publish your
> real user/password on usenet? You _are_ passing in your own real Gmail
> user-id and password when you run your program?


No, they are dummy values. I did not do that mistake
But I could have made it clear by calling it e.g. dummy_password or
something.
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      06-09-2010
On Tue, 8 Jun 2010 02:08:50 -0700 (PDT), jesbox <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

>
>I am trying to get JavaMail to work and have picked a library "Very
>Simple Java Mail" at http://code.google.com/p/vesijama/ that seems to


I used Sun's JavaMail implementation and it works without trouble. See
http://mindprod.com/products.html#BULK for the source code.
--
Roedy Green Canadian Mind Products
http://mindprod.com

Have you ever noticed that any computer search in the movies, is always linear, with, for example, candidate fingerprints flashing up on the screen one after another? The public is still under the delusion that electronic files are microscopic filing cabinets made out of tiny wires or magnetic patches inside the computer. Most lay people are surprised that it is easy for a computer to file things simultaneously by a dozen different schemes, and that they can have any report printed in any number of different sorted orders. With physical files, they are limited to one ordering/access.
 
Reply With Quote
 
Martin Gregorie
Guest
Posts: n/a
 
      06-09-2010
On Wed, 09 Jun 2010 06:16:10 -0700, Roedy Green wrote:

> On Tue, 8 Jun 2010 02:08:50 -0700 (PDT), jesbox <(E-Mail Removed)>
> wrote, quoted or indirectly quoted someone who said :
>
>
>>I am trying to get JavaMail to work and have picked a library "Very
>>Simple Java Mail" at http://code.google.com/p/vesijama/ that seems to

>
> I used Sun's JavaMail implementation and it works without trouble. See
> http://mindprod.com/products.html#BULK for the source code.


Same here. The examples in Sun's Javamail API Design Specification are
clear and useful and so are the JavaMail class specification. Read them
in that order to get a good idea of how it all works. Using JavaMail
directly doesn't add much complexity over an above the Google wrapper
classes you're using and you may find you get more help if you use bare
JavaMail, simply because more of us have used it than that Google
package.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
 
Reply With Quote
 
Paul Cager
Guest
Posts: n/a
 
      06-09-2010
On Jun 9, 2:15*pm, jesbox <(E-Mail Removed)> wrote:
> No, they are dummy values. I did not do that mistake
> But I could have made it clear by calling it e.g. dummy_password or
> something.


Worth asking....

As others have said, it might be less confusing to use JavaMail
directly rather than via vesijama. But it could be interesting to use
a TCP monitor (such as Wireshark, http://www.wireshark.org/download.html)
to see exactly what is being sent to the mail server. To see it all in
plain text you'd have to disable SSL, though.
 
Reply With Quote
 
Arne Vajh°j
Guest
Posts: n/a
 
      06-10-2010
On 09-06-2010 04:23, jesbox wrote:
> On Jun 9, 1:30 am, Arne Vajh°j<(E-Mail Removed)> wrote:
>> On 08-06-2010 18:58, jesbox wrote:
>>
>>> Thanks for the tips. I have changed into hard-coded values, i.e.
>>> System.setProperty("mail.smtps.auth", "true"); // enable https

>>
>> Not so relevant for your problem but you are using
>> SMTP over SSL where HTTPS is HTTP over SSL.

>
> Right, I try to run SMTP over SSL. And, as you suggest, that insight
> does not bring me forward.
> Thanks for the enlightment anyway.


I just wanted to avoid future confusion by other readers.

Arne

 
Reply With Quote
 
Nigel Wade
Guest
Posts: n/a
 
      06-10-2010
On Tue, 08 Jun 2010 15:58:56 -0700, jesbox wrote:

> Thanks for the tips. I have changed into hard-coded values, i.e.
> System.setProperty("mail.smtps.auth", "true"); // enable https new
> Mailer("smtp.gmail.com", 465, "(E-Mail Removed)",
> "a_password").sendMail(email);
>
> The exception I get is:
> org.codemonkey.vesijama.MailException: Generic error: Could not connect
> to SMTP host: smtp.gmail.com, port: 465, response: -1
> at org.codemonkey.vesijama.Mailer.sendMail(Mailer.jav a:180) at
> TestMail.sendMail(TestMail.java:57) at
> TestMail.testMail(TestMail.java:52) at TestMail.main(TestMail.java:33)
> Caused by: javax.mail.MessagingException: Could not connect to SMTP
> host: smtp.gmail.com, port: 465, response: -1
> at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTra nsport.java:
> 1533)
> at
> com.sun.mail.smtp.SMTPTransport.protocolConnect(SM TPTransport.java: 453)
> at javax.mail.Service.connect(Service.java:313) at
> javax.mail.Service.connect(Service.java:172)



Do you know that smtps works with the vesijama Mailer class?

In my limited understanding of JavaMail I believe that to use smtps
requires the use of a different Transport. The contents of the Mailer
class is a black box. If it doesn't select the correct Transport for the
smtps protocol then the connection will definitely fail in the SSL
handshake.

I would use the bare JavaMail interface rather than some unknown wrapper
class. At least you can then see exactly what's going on. If you google
"gmail javamail" you should get some useful info. Very high up on the
list of results is the JavaMail FAQ, and that has pointers to example
code, and includes an example of smtps mail submission to Gmail.

--
Nigel Wade
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: A fresh new approach to making making online Fakename Computer Information 0 11-18-2005 02:10 AM
pop3s + javamail 1.3.2ea - does it really work? Michal M Java 0 04-04-2005 07:47 AM
Making new Flavors : Making a custom transferhandler for and drop applications ebby83@gmail.com Java 5 01-12-2005 11:10 AM
Re: Smtp Server error with JavaMail GaryM Java 8 07-21-2003 02:54 PM
Re: Smtp Server error with JavaMail Joseph Millar Java 0 07-16-2003 06:18 PM



Advertisments