forked from vimal-java-dev/vimaltech-contact-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmailTestController.java
More file actions
35 lines (29 loc) · 1.14 KB
/
EmailTestController.java
File metadata and controls
35 lines (29 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.vimaltech.contactapi.controller;
import com.vimaltech.contactapi.config.AppProperties;
import com.vimaltech.contactapi.dto.EmailRequest;
import com.vimaltech.contactapi.service.EmailService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//@Profile({"dev"})
//@Profile({"dev", "local"})
@RestController
@RequestMapping("/test")
@RequiredArgsConstructor
public class EmailTestController {
private final EmailService emailService;
private final AppProperties appProperties;
@GetMapping("/email")
public String testEmail() {
emailService.sendEmail(
EmailRequest.builder()
.to(appProperties.getEmail()) // 👈 CHANGE THIS
.subject("Test Email from VimalTech API")
.body("Email service is working successfully 🚀")
.build()
);
return "Email sent successfully";
}
}