-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68c4321
commit a43b5fd
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.luminex.services; | ||
|
||
public interface EmailService { | ||
void sendEmail(String to,String subject,String body); | ||
|
||
void sendEmailWithHtml(); | ||
|
||
void sendEmailWithAttachment(); | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/luminex/services/impl/emailServiceimpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.luminex.services.impl; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.mail.SimpleMailMessage; | ||
import org.springframework.mail.javamail.JavaMailSender; | ||
import org.springframework.stereotype.Service; | ||
|
||
import com.luminex.services.EmailService; | ||
|
||
@Service | ||
public class emailServiceimpl implements EmailService{ | ||
|
||
@Autowired | ||
private JavaMailSender emailsender; | ||
|
||
@Value("${spring.mail.properties.domain_name}") | ||
private String domain_name; | ||
|
||
|
||
@Override | ||
public void sendEmailWithHtml() { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void sendEmailWithAttachment() { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void sendEmail(String to, String subject, String body) { | ||
|
||
SimpleMailMessage message=new SimpleMailMessage(); | ||
message.setTo(to); | ||
message.setSubject(subject); | ||
message.setText(body); | ||
message.setFrom(domain_name); | ||
emailsender.send(message); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
package com.luminex; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import com.luminex.services.EmailService; | ||
|
||
@SpringBootTest | ||
class LuminexApplicationTests { | ||
|
||
@Test | ||
void contextLoads() { | ||
} | ||
|
||
@Autowired | ||
private EmailService service; | ||
|
||
@Test | ||
void sendEmailTest() { | ||
service.sendEmail("debasismishra000123@gmail.com", "Testing mail", "Working fine"); | ||
} | ||
|
||
} |