• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Java Mail sending with attachments

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am using the below code part to send mails with attachments.


The above code works with files having size upto 6 MB. For files greater than 6 MB, I am getting the below exception thown at line number 31:

javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 552 #5.3.4 message size exceeds limit


Could you guys consider sorting out this issue?

Thanks>
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lots of mail servers reject attachments of X MB or bigger, for varying values of X. Anything larger than 3 MB is definitively not a good idea.
 
Deepan Ignatius
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But by using the below unix command, I am able to send file with more than 10 MB also

/usr/bin/uuencode "filename" "filename" | mailx -s "subject" mailids

Are there any options in Java to overcome this?
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using the same mail host? Because it's not Java that's rejecting the message, it's the server. The exception message, "552 #5.3.4 message size exceeds limit", is a message that comes directly from the server; the 552 is the server's status code which basically means "Requested mail action aborted: exceeded storage allocation".
 
Deepan Ignatius
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure of it. How to check the mailhost?

Also could you share with me the doc you are referencing to find in detail the exception meaning? Thanks!
 
Rob Spoor
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.greenend.org.uk/rjk/2000/05/21/smtp-replies.html

The mailhost is what you're connecting to; for the Java code it's the content of the "host" variable. I have no idea what mailx uses, but it could use the local machine as an intermediate.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic