aspose file tools*
The moose likes Servlets and the fly likes Using sun.net.smtp.SmtpClient Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using sun.net.smtp.SmtpClient " Watch "Using sun.net.smtp.SmtpClient " New topic
Author

Using sun.net.smtp.SmtpClient

Kwess LC
Greenhorn

Joined: Feb 27, 2004
Posts: 2
Hi, does anybody knows how can I send emails to different recipients (to, cc, bcc) using the sun.net.smtp.SmtpClient class.
I used this code but it just only has functions for sending with "To:"

Any idea how can I send emails with "cc" and "bcc"?
Thanks
Chris Stehno
Ranch Hand

Joined: Feb 26, 2001
Posts: 180
Sun's SMTP client is fairly simple, but I think it probably supports what you are looking for. Have you tried just adding:
message.println("CC: " + cc);
It might work. Also, unless you have some restriction against using it, the JavaMail API is pretty easy to use also, and it supports pretty much everything you can do with email.
Hope this helps.


- Chris Stehno, SCPJ
Kwess LC
Greenhorn

Joined: Feb 27, 2004
Posts: 2
Thanks a lot.
I do that you tell me, I add:
message.println("CC: " + cc);
and it works, i received the mail as cc recipient.
Then i try adding
message.println("BCC: " + bcc);
but i did't receive any mail as bcc recipient. I don't know why.
Maybe I should try to use JavaMail Api
thanks and regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using sun.net.smtp.SmtpClient