FYI - if you use an open relay or free outbox provider, most spam
programs will put your emails into their spam folders. There is also
a possibility of providers bouncing the emails. Make sure your users
are aware of this.
----- Original Message -----
From: Jeykumar, Nattamai S. (LNG-DAY) <nattamai.jeykumar@xxxxxxxxxxxxxx>
Date: Fri, 9 Jul 2004 11:23:29 -0400
Subject: RE: [cinjug-users] sending email from java
To: "Jason Kretzer/STAR BASE Consulting Inc." <jkretzer@xxxxxxxxxxxxxxx>
Cc: users@xxxxxxxxxx
Jason,
Try
the following. This will send email using the outbox
"mailhost.worldnet.att.net".
==============================================================
import
java.io.BufferedReader;
import java.io.InputStream;
import
java.io.InputStreamReader;
import java.io.PrintStream;
import
java.io.PrintWriter;
import java.net.Socket;
import
sun.net.smtp.SmtpClient;
public
class MailMan {
public MailMan() {
}
public void sendEmail(String from, String to, String subject, String message)
{
PrintStream out;
SmtpClient
send;
try {
send = new
SmtpClient("mailhost.worldnet.att.net"); //Do not spam. ATT will
find you easily
send.from(from);
send.to(to);
out =
send.startMessage();
out.println("From: " +
from);
out.println("To: " + to);
out.println("Subject: " + subject);
out.println(message);
out.flush();
out.close();
send.closeServer();
} catch
(java.io.IOException e)
{
System.out.println(e.getMessage());
}
}
public static void main(String[] args)
{
MailMan mm = new MailMan();
mm.sendEmail("JKretzer@xxxxxxxxxxxxxxx", "JKretzer@xxxxxxxxxxxxxxx",
"MailMan",
"MailMan delivered this package for you.
Enjoy!!!");
}
}
=============================================================
All you have to do is
find a free outbox provider.
Thanks,
Jey
Kumar
-----Original Message-----
From:
Jason Kretzer/STAR BASE Consulting Inc.
[mailto:JKretzer@xxxxxxxxxxxxxxx]
Sent: Friday, July 09, 2004 10:55
AM
To: bmanuel@xxxxxxxxxx
Cc:
users@xxxxxxxxxx
Subject: Re: [cinjug-users] sending email from
java
>From my original post.
"Unfortunately, I
do not have access to ...
SMTP server."
Thanks though.
-Jason
bmanuel@xxxxxxxxxx
07/09/2004 10:53 AM
To
"Jason Kretzer/STAR BASE
Consulting Inc." <JKretzer@xxxxxxxxxxxxxxx>
cc
users@xxxxxxxxxx
Subject
Re: [cinjug-users] sending email
from java
You don't need an smtp server installed, you just
need access to one.
Bill Manuel
Sun Certified Web Component
Developer
Supply Chain Systems
The Kroger
Co.
bmanuel@xxxxxxxxxx
"Jason
Kretzer/STAR
BASE
Consulting Inc."
To
<JKretzer@starbas
users@xxxxxxxxxx
einc.com>
cc
07/09/2004 10:47
Subject
AM
[cinjug-users] sending email from
java
Hello List,
I have an html form that I would
like to have emailed to a person after
being processed by a servlet.
Unfortunately, I do not have access to nor
permission to install and
SMTP server on the box. Is there a way to do
this in
java?
Thanks,
-Jason
|