I have not used the Sun's SMTP Client; however I have a successful
implementation of a mailer that I developed for our company using java.

Once you've established connnection with the SMTP host, and send the
Receipient and Sender's address. As part of the data, you need to send the
text:

"Subject: This is my subject string";
"Date: This is the current date";

Maybe you can snoop around the SmtpClient() code and see how it's doing
this. I've just used sockets to establish a connection and get the mail out.


Hope this helps.
Neelesh

-----Original Message-----
From: Dave Updike [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 25, 2000 7:57 AM
To: [EMAIL PROTECTED]
Subject: Help with SMTP emailing, no subject in 2nd


Hey all,

My problem is that using this process, the first email
is fine, the second emailworks but the is NO SUBJECT.
But I use the same code.

I have a servlet that uses SMTP to email.  From
ServletA.methodB I get the needed strings and then
call ServletC.methodD() to do the email.  I have 2
email address so this is done like twice in a row from
ServletA.methodB().  (Some code left out for
readability.)

ServletA.methodB() {
    ServletC.methodD(subject,from,to1,msg,smtpHost);
    ServletC.methodD(subject,from,to2,msg,smtpHost);
}

FYI: ServletB   import sun.net.smtp.SmtpClient;
ServletB.sendEmail(subject,from,to,msg,smtpHost) {
   SmtpClient smtp = new SmtpClient(smtpHost);
   smtp.from(from);
   smtp.to(to);
   PrintStream ps = smtp.startMessage();
   ps.println('\n' + "Subject:" + subject);
   ps.println(msg);
   smtp.closeServer();
   ps.close();

The fist email goes and is perfect.
The second email goes and is correct EXCEPT that there
is NO SUBJECT!

Has anyone ever experienced this?  Any suggestions?

Thanks for any help,

Dave Updike
Greenbrier & Russel, Inc. - Dallas, TX

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to