Sending mail with Java

Discussion in 'Java' started by Beckam, Jun 10, 2008.

  1. Beckam

    Beckam Guest

    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
    Beckam, Jun 10, 2008
    #1
    1. Advertising

  2. Beckam

    David Segall Guest

    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

    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.
    David Segall, Jun 10, 2008
    #2
    1. Advertising

  3. Beckam

    Dave Miller Guest

    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/
    Dave Miller, Jun 10, 2008
    #3
  4. Beckam

    mich Guest

    "Beckam" <> wrote in message
    news:...
    >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.
    mich, Jun 10, 2008
    #4
  5. 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
    Roland de Ruiter, Jun 10, 2008
    #5
  6. Beckam

    Dave Miller Guest

    mich wrote:
    > "Beckam" <> wrote in message
    > news:...
    >> 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/
    Dave Miller, Jun 10, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    55,470
  2. =?Utf-8?B?T3Bh?=

    Sending Mail via System.Net.Mail problem

    =?Utf-8?B?T3Bh?=, Jan 25, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    3,599
    sachya
    Jan 31, 2006
  3. =?ISO-8859-1?Q?Andr=E9s_Berenguer?=

    Sending e-mail with attachments with the default e-mail client

    =?ISO-8859-1?Q?Andr=E9s_Berenguer?=, Aug 29, 2003, in forum: Java
    Replies:
    0
    Views:
    510
    =?ISO-8859-1?Q?Andr=E9s_Berenguer?=
    Aug 29, 2003
  4. Replies:
    0
    Views:
    1,357
  5. Luke
    Replies:
    2
    Views:
    4,705
    Nigel Wade
    Mar 15, 2007
Loading...

Share This Page