f



Sending mail with Java

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
0
mesbaki87 (11)
6/10/2008 2:39:38 PM
comp.lang.java.programmer 52711 articles. 1 followers. Post Follow

5 Replies
427 Views

Similar Articles

[PageSpeed] 26

Beckam <mesbaki87@gmail.com> wrote:

>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.
0
david7254 (239)
6/10/2008 2:57:59 PM
Beckam wrote:
> 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");
-- 
Dave Miller
Java Web Hosting at:
http://www.cheap-jsp-hosting.com/
0
6/10/2008 2:59:37 PM
"Beckam" <mesbaki87@gmail.com> wrote in message 
news:ece653d3-0a5d-4b2e-8c37-31256115529a@k30g2000hse.googlegroups.com...
>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. 


0
copkat (12)
6/10/2008 4:35:04 PM
On 10-6-2008 16:39, Beckam wrote:
> 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]
-- 
Regards,

Roland
0
6/10/2008 4:39:38 PM
mich wrote:
> "Beckam" <mesbaki87@gmail.com> wrote in message 
> news:ece653d3-0a5d-4b2e-8c37-31256115529a@k30g2000hse.googlegroups.com...
>> 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. 
> 
> 
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.

-- 
Dave Miller
Java Web Hosting at:
http://www.cheap-jsp-hosting.com/
0
6/10/2008 5:47:05 PM
Reply: