Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Sending Email in java through MS Exchange Server

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can somebody walk me to an API on how to send an email using my exchange server properties. I need to send multiple files to multiple recipients with a body message that does not change, so If i can develop a small app for this, it would be really helpful.
Thanks
 
Marshal
Posts: 26613
81
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
JavaMail is that API. The download includes simple examples of sending e-mail as well as receiving e-mail.
 
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,
Ive downloaded it but not able to send, this is the example i am using from the file I downloaded...



and this is the error I am getting..



If it is exchanage server, how can I authenticate?
thanks..
 
Paul Clapham
Marshal
Posts: 26613
81
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
Isn't that in the JavaMail FAQ? Anyway if you don't find the answer in the FAQ, the way to find out about authenticating to that server is to talk to its administrator.
 
Sheriff
Posts: 22208
117
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
I don't think authentication is the problem. If you check the stack trace you will see this:
That means that the server you're not allowed to send emails to the domain. You need to change the relaying settings of the mail server.

PS: Eduardo, next time also remove the real email addresses from your stack trace I've done that for you.
 
Paul Clapham
Marshal
Posts: 26613
81
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:I don't think authentication is the problem.



It might be or it might not be. It's possible the server is configured to let authorized users relay. The only way to find out is to ask the server's administrator, as I already suggested. I can see it's a server within the same LAN from its IP address, and it's a fairly large LAN too, so probably you (Eduardo) are in an environment where running a mail server is a serious business. So you should seriously talk to the server administrator; if you make a mess and get your company's server on a spam black-list, it's much better if you had permission from the administrator before doing that.
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic