• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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: 43028
76
  • 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: 22701
129
Eclipse IDE Spring VI Editor Chrome 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: 22701
129
Eclipse IDE Spring VI Editor Chrome 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.
 
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic