Sending mail with Java

B

Beckam

I would like to know how to send a mail in a java application
I searched on the web and I found some codes but it always don't
work , because i don't have the name of a mail server
i tried this :
" props.put("mail.smtp.host", "smtp.gmail.com"); "
but it doesn't work ...
if any one could help me , i will be very gratefull
Thanks
 
D

David Segall

Beckam said:
I would like to know how to send a mail in a java application
I searched on the web and I found some codes but it always don't
work , because i don't have the name of a mail server
i tried this :
" props.put("mail.smtp.host", "smtp.gmail.com"); "
but it doesn't work ...
if any one could help me , i will be very gratefull
It will never work without a mail (SMTP) server. I note that you are
using gmail but perhaps your ISP provides access to an SMTP server. If
you can use a standard email client like Outlook or Thunderbird to
send an email you can copy the name of the SMTP server from it.
Otherwise, you will have to install an SMTP server on your own
computer or network. Most ISPs make this as difficult as possible
because it is a common source of spam.
 
D

Dave Miller

Beckam said:
I would like to know how to send a mail in a java application
I searched on the web and I found some codes but it always don't
work , because i don't have the name of a mail server
i tried this :
" props.put("mail.smtp.host", "smtp.gmail.com"); "
but it doesn't work ...
if any one could help me , i will be very gratefull
Thanks
If you do not have an smtp server on your computer, you'll need to use
your ISP or some other mail server that accepts outbound mail from your
ip. i.e.
props.put("mail.smtp.host", "smtp.your_isp.com");
 
M

mich

Beckam said:
I would like to know how to send a mail in a java application
I searched on the web and I found some codes but it always don't
work , because i don't have the name of a mail server
i tried this :
" props.put("mail.smtp.host", "smtp.gmail.com"); "
but it doesn't work ...
if any one could help me , i will be very gratefull
Thanks

Seems to me that without a mail server you can't send mail.
 
R

Roland de Ruiter

I would like to know how to send a mail in a java application
I searched on the web and I found some codes but it always don't
work , because i don't have the name of a mail server
i tried this :
" props.put("mail.smtp.host", "smtp.gmail.com"); "
but it doesn't work ...
if any one could help me , i will be very gratefull
Thanks

You'll have to set up a secure connection (SSL) if you want to send mail
through GMail's SMTP server.

For example code, see
<http://forum.java.sun.com/thread.jspa?threadID=668779#9998032>

[Author claims it "works perfectly fine", but I haven't tried the code
myself]
 
D

Dave Miller

mich said:
Seems to me that without a mail server you can't send mail.
Every e-mail client in the world sends e-mail via an outside mail server
- generally provided by the ISP that also connects the user to the net.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

java mail api 3
Sending Mail Problem with NTLM 0
Sending Error when attaching files 1
java mail and thread 4
Mail alearter in java 2
Send mail with israelian text 1
E-mail sending problem. 0
Sending e-mail 4

Members online

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top