🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17146

Re: Sending email in the background.

#17146
From: John P. McGrath
Date: Sun, 13 Dec 1998 00:00
42 lines
1929 bytes
MarkL <leavym@easynet.co.uk> wrote:

> Im currently developing an app where i'd like to be able
> to send an email to someone if an error occurs. This would 
> obviously be have to be done in the background. Any ideas??
> 
> I was thinking along the lines of using Telent to connect
> to port 25, then issuing mail commands.

Instead of using Telnet, you could just open the socket directly from 
the Java program.  The code that sets up the connection should look 
something like:

    static final int mailPort = 25;
      :
    InetAddress addr = InetAddress.getByName( "mail.domain.com" );
    Socket socket = new Socket( addr, mailPort );
    InputStream in = socket.getInputStream();
    OutputStream out = socket.getOutputStream();

Then, you just read from "in" and write to "out".

But before writing something like this, you ought to check to see if 
it has already been written.  I would recommend checking out:

<http://www.javasoft.com/products/javamail/index.html>   This is a new 
API, a standard extention I believe (i.e. javax.mail...).  I am not 
certain if this does what you need, but it is worth a look.

<http://www.alphaWorks.ibm.com/foundry>   I saw something about a mail 
bean here.  Sounds like it is what you need, but I do not remember the 
details.

<http://www.jars.com>   Has reviews and links for all sorts of Java 
related stuff.

-- 
Regards,

John P. McGrath
<mcgrath@enter.net>
<jpm@nscs.fast.net>
Technical Details
Message-ID: <MPG.10dd5c95f1fce7c98974b@forums.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <74ujok$irh6@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,69ed0ae24b752968
X-Google-Attributes: gidf74b3,public
From: mcgrath@enter.net (John P. McGrath)
Subject: Re: Sending email in the background.
Date: 1998/12/13
Message-ID: <MPG.10dd5c95f1fce7c98974b@forums.inprise.com>
X-Deja-AN: 421753455
References: <74ujok$irh6@forums.borland.com>
Organization: Software Consulting Services
Newsgroups: borland.public.jbuilder.java.language