This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Sending email through springboot and angular  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a contact form for a project that i am doing for school, but in our project we are using jhipster. jhipster uses springboot and angular and even though i have experience with spring boot, angular is giving me problems. My problem in my code is that it is not sending the email that i have made in my java implementation. When i press submit it defaults to my fallback error. Since I am new to angular I am having trouble understanding where the problem is generating from. Please help me, i have been trying for two weeks now with no success.







 
Sheriff
Posts: 21694
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@RequestMapping requires you to set the allowed HTTP methods when used on a method level. You should use either @RequestMapping(path = "/api/contact", method = RequestMethod.POST), or shorter @PostMapping("/api/contact"). You might then run into 415 errors; that can be solved by setting the consumes property correctly (to HttpMethod.APPLICAITON_JSON_VALUE).
 
Henna Ghayas
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for replying, could you explain what the complains property is? I have never heard of it
 
Henna Ghayas
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean consumes
 
Rob Spoor
Sheriff
Posts: 21694
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The consumes property is used to define which request Content-Type headers are accepted. Likewise, the produces property is used to define what Content-Type the response has.

I actually don't know what happens if you don't define any consumes for a POST or PUT request. It may accept everything, or it may accept nothing. If you want to accept any Content-Type header you can use MediaType.ALL_VALUE.
 
Henna Ghayas
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i know this is a long time after but I wanted to ask, I was actually able to get the email sent but now the contents of the message are all null, do you have any idea of a reason that could happen?
 
Rob Spoor
Sheriff
Posts: 21694
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open your browser's development tools and check what the POST request actually contains.
 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!