21
21
import com .mailjet .client .MailjetRequest ;
22
22
import com .mailjet .client .MailjetResponse ;
23
23
import com .mailjet .client .errors .MailjetException ;
24
+ import com .mailjet .client .errors .MailjetSocketTimeoutException ;
24
25
import com .mailjet .client .resource .Email ;
25
26
// [END mailjet_imports]
26
27
30
31
// [START app]
31
32
public class MailjetSender {
32
33
33
- public static void main (String [] args ) {
34
+ public static void main (String [] args ) throws MailjetException , MailjetSocketTimeoutException {
34
35
final String mailjetApiKey = "YOUR-MAILJET-API-KEY" ;
35
36
final String mailjetSecretKey = "YOUR-MAILJET-SECRET-KEY" ;
36
37
MailjetClient client = new MailjetClient (mailjetApiKey , mailjetSecretKey );
@@ -39,7 +40,8 @@ public static void main(String[] args) {
39
40
sender .sendMailjet (args [0 ], args [1 ], client );
40
41
}
41
42
42
- public MailjetResponse sendMailjet (String recipient , String sender , MailjetClient client ) {
43
+ public MailjetResponse sendMailjet (String recipient , String sender , MailjetClient client )
44
+ throws MailjetException , MailjetSocketTimeoutException {
43
45
MailjetRequest email = new MailjetRequest (Email .resource )
44
46
.property (Email .FROMEMAIL , sender )
45
47
.property (Email .FROMNAME , "pandora" )
0 commit comments