-
Notifications
You must be signed in to change notification settings - Fork 10
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
Showing
5 changed files
with
64 additions
and
10 deletions.
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
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
32 changes: 32 additions & 0 deletions
32
...in/java/com/petclinic/visits/visitsservicenew/DomainClientLayer/SimpleJavaMailClient.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,32 @@ | ||
package com.petclinic.visits.visitsservicenew.DomainClientLayer; | ||
|
||
|
||
import lombok.NoArgsConstructor; | ||
import org.simplejavamail.api.email.Email; | ||
import org.simplejavamail.api.mailer.Mailer; | ||
import org.simplejavamail.api.mailer.config.TransportStrategy; | ||
import org.simplejavamail.email.EmailBuilder; | ||
import org.simplejavamail.mailer.MailerBuilder; | ||
|
||
|
||
@NoArgsConstructor | ||
public class SimpleJavaMailClient { | ||
private final Email email = EmailBuilder.startingBlank() | ||
.from("From", "[email protected]") | ||
.to("William", "[email protected]") | ||
.withSubject("Email test with simple java mail") | ||
.withPlainText("Email Body") | ||
.buildEmail(); | ||
|
||
private final Mailer mailer = MailerBuilder | ||
.withSMTPServer("smtp.gmail.com", 587, "[email protected]", System.getenv("SMTP_PASS")).withTransportStrategy(TransportStrategy.SMTP_TLS) | ||
// .withEmailOverrides(EmailBuilder.startingBlank().from("From", "[email protected]").buildEmailCompletedWithDefaultsAndOverrides()) | ||
.buildMailer(); | ||
|
||
|
||
public void sendMail(){ | ||
/*Email email*/ | ||
mailer.sendMail(email); | ||
} | ||
|
||
} |
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