Package com.example.demo.email
Class EmailService
java.lang.Object
com.example.demo.email.EmailService
- All Implemented Interfaces:
EmailSender
Concrete implementation of the
EmailSender interface, utilizing
Spring Boot's JavaMailSender to dispatch emails.-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
EmailService
public EmailService()
-
-
Method Details
-
send
Sends an email asynchronously to a specified recipient with the given HTML content.The subject is hardcoded to "Confirm your email" and the sender is hardcoded to "leoyegh@gmail.com". The email content is treated as HTML.
- Specified by:
sendin interfaceEmailSender- Parameters:
to- The email address of the recipient.email- The content (body) of the email, usually HTML.- Throws:
IllegalStateException- if aMessagingExceptionoccurs during the email sending process.
-