• 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

JavaMail program not working for XLS attachment

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have following program. This is working for txt type file attachment but for xls file attachment , it is not working. Sometimes it works for xls type  also. I am not getting why it is not working every xls file. Can anyone please help me to pinpoint if any issue with program code?



 
Marshal
Posts: 74341
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please always use the code button for code. Since you are new, I have used the code button on your post, and doesn't it look better
I hardly know anything about JavaMail, but I found one of your comments confusing. It said localhost and the IP text began 11. I thought local IPs began ≥168. I presume you have got the IP from somewhere; please explain.
We cannot work out what is going wrong unless we know fuller details. Do you have an exception thrown? Does the message come back as undeliverable? What error message do you get?
 
Saloon Keeper
Posts: 7162
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does "not working" mean, exactly? What does or does not happen, and what were you expecting instead?
 
Shilpa Beke
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.

Let me explain, "Not working" means what exactly happening.
Same code works fine when I send txt file as attachment but when I attach xls file as attachment, program does not give any error . Program complete successfully however no email is coming.
I further added statement  session.setDebug(true) statement to debug issue. I found below findings.

1) When I add txt file as attachment, debug statements regarding attachment shows below contents.

------=_Part_0_1789447862.1582278832842
Content-Type: text/plain; charset=us-ascii; name=2.txt
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=2.txt



2) When I add xls file as attachment, debug statements regarding attachment shows below contents.

------=_Part_0_1789447862.1582278739282
Content-Type: application/octet-stream; name=Test.xlsx
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=Test.xlsx

UEsDBBQABgAIAAAAIQCkU8XPTgEAAAgEAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbKyTy07DMBBF
90j8Q+Qtit2yQAg17YLHErooH2DiSWLVL3nc0v49E/exQKEVajexYs/ccz0znsw21hRriKi9q9iY
j1gBrvZKu7Zin4u38pEVmKRT0ngHFdsCstn09may2AbAgrIdVqxLKTwJgXUHViL3ARydND5ameg3
tiLIeilbEPej0YOovUvgUpl6DTadvEAjVyYVrxva3jmJYJAVz7vAnlUxGYLRtUzkVKyd+kUp9wRO
mTkGOx3wjmwwMUjoT/4G7PM+qDRRKyjmMqZ3acmG2Bjx7ePyy/slPy0y4NI3ja5B+XplqQIcQwSp
sANI1vC8ciu1O/g+wc/BKPIyvrKR/n5Z+IyPRP0Gkb+XW8gyZ4CYtgbw2mXPoqfI1K959AFpciP8
n34YzT67DCQEMWk4DudQk49EmvqLrwv9u1KgBtgiv+PpDwAAAP//AwBQSwMEFAAGAAgAAAAhALVV
MCP0AAAATAIAAAsAAABfcmVscy8ucmVsc6ySTU/DMAyG70j8h8j31d2QEEJLd0FIuyFUfoBJ3A+1
jaMkG92/JxwQVBqDA0d/vX78ytvdPI3qyCH24jSsixIUOyO2d62Gl/pxdQcqJnKWRnGs4cQRdtX1


Therefore when encoded content attachments are there like xls file, program complete successfully however no email coming.
 
Tim Moores
Saloon Keeper
Posts: 7162
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With JavaMail debugging turned on, there must be a whole lot more output - post it in its entirety.
 
Tim Moores
Saloon Keeper
Posts: 7162
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:It said localhost and the IP text began 11. I thought local IPs began ≥168.


The IP has now been edited to reflect the proper value of 10 instead of 11. Note that there are various ranges of private IPs, including 192.168.x.y and 10.x.y.z
 
Campbell Ritchie
Marshal
Posts: 74341
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Tim. It must have been 192.168.... I was thinking of.
 
Marshal
Posts: 3708
523
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shilpa Beke wrote:I further added statement  session.setDebug(true) statement to debug issue. I found below findings. ... Therefore when encoded content attachments are there like xls file, program complete successfully however no email coming.


Can you provide the complete debug output (obfuscate anything confidential)?  What you have shown does not include any of the actual communications or transport of the email message.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic