• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sending email with multiple attachments not working

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi have a folder with many subfolders and within the subfolders there are multiple files. For every subfolder it goes out to a different persond and in the email I want to include the files withing that folder. I have that working, but I cannot seem to attache more than one file per email. Also I want to send one email with one destinatary and multiple carbon copies but everytime i send an email if i have 2 email sin my cc filed I get 3 copies of the same email in my sent folder, one for the To address and 2 for the cc adreeses. I am using Exjello library...please help me debug why I am only attaching one file from every subfolder, instead of 2+.
Thank you

 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too difficult a question for “beginning.” Moving thread.
 
Eduardo Ponce de Leon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok...So I have figured out why I wasnt able to send multiple files... My only problem now is when I send the email i get a copy created for all destinataries instead of just 1 that incluedes all (cc´s and bcc´s)

Thank you..
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you say "I get a copy..." could you explain what "I" and "get" mean in that sentence? A little bit more precision about what those copies are and where they are would be helpful.

Also I don't see why you would expect only one message when you're calling the sendMessage() method twice. I would expect your server to deal with at least two messages.
 
Eduardo Ponce de Leon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul,
thanks for the reply. What I mean is the items created on my sent folder in Outlook. I udnerstand that I call the send method twice. But I havent figured out how to just call the send method once and send the email to both to-emails, cc-emails, and bcc-emails calling just one methond. I hope that explains the problem.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, in ordinary JavaMail you would add the recipients (all of them) to the message and then send the message. You're doing the first part of that right but the second part wrong. Unfortunately you're using that "ExchangeTransport" class which I never heard of. Does it not have a simple "sendMessage(msg)" method?
 
Eduardo Ponce de Leon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason I am using this library is becuase I could not authenticate through JavaMail using exchange, with this library i have no problem. It uses JavaMail too. if you see my code i also add them to the message, but I cannot add them all to one array of InternetAddress
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I said that the code where you add the recipients to the message is correct, but then I spent a moment to look at the API documentation and noticed the existence of Message's "addRecipients" method. You should switch to using that.

What I said about the "sendMessage" still applies, though.

I should mention that I don't have any trouble authenticating to Exchange through JavaMail.
 
Eduardo Ponce de Leon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok.. what is the difference though?
if I do this...

then how do I send the message, if the cal method is of tyep mailer.sendMessage(Message m, InternetAddress[] a), i still not able to send just one message with all the destinataries (to,cc,bcc) in one email item.

Do you have some snippets of the authentication and sending a simple email message?
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eduardo Ponce de Leon wrote:then how do I send the message, if the cal method is of tyep mailer.sendMessage(Message m, InternetAddress[] a), i still not able to send just one message with all the destinataries (to,cc,bcc) in one email item.


I have no idea. As I said I don't know anything about that package. If that's the only "sendMessage" method it supports then apparently it doesn't support BCC recipients. (You could always combine the TO and CC recipients into one array.) Of course I say that without seeing the API documentation...

Do you have some snippets of the authentication and sending a simple email message?


Authentication:


Defining recipients:


Sending message:

 
Eduardo Ponce de Leon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
on user ive seen multiple combinations in the form of

domain\account:user@hotmail.com

which one should I use...I am going to try it...
Thanks!
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I authenticate to Exchange from JavaMail, the user name that I use is the same one that I use when I authenticate with my hands on a keyboard. At any rate if you want to know what to use in your environment, I don't think that guessing is going to help. Ask your Exchange administrator what you should be using.
 
Eduardo Ponce de Leon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will do thanks for the tips...
Do you have any idea what this error is about??

 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I do. However you might want to have a look at the JavaMail FAQ (http://www.oracle.com/technetwork/java/faq-135477.html) so you don't have to ask about all of them as you encounter them. You'll find it in there, but I recommend reading through the whole thing. If you're going to be sending e-mail it's a good idea to understand how Internet e-mail works, and the FAQ tells you a lot of things about that.
reply
    Bookmark Topic Watch Topic
  • New Topic