• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Using sun.net.smtp.SmtpClient

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Kwess LC
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic