embulk-output-send_email 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/build.gradle +1 -1
- data/classpath/embulk-output-send_email-0.1.3.jar +0 -0
- data/example/config.yml +5 -8
- data/src/main/java/org/embulk/output/send_email/SendEmailOutputPlugin.java +19 -8
- metadata +2 -3
- data/classpath/embulk-output-send_email-0.1.1.jar +0 -0
- data/embulk-output-send_email-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0ad269786255162b0dde2853c30d0bd12d6817672b2cc5773b6efc72d536f98
|
4
|
+
data.tar.gz: 38c326b157f949ac5f3659902ea84e24cb8ba1cc36b0e7488b95916d4d3aa8c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc7928125442792ef66f272c85c615df24ba64da2ab8ed9c92d132d2dceac77b51530f662fe67c1de6673a36976cd36e6730fbca2d1ee46b1fa670a38f51e4b2
|
7
|
+
data.tar.gz: 4fb22fc2bbd4bfffd431efdc57e2a89834eb2248dd84ec61bf51b1f16055e823877487594774e0a0475cb58e83b48446bfb0122b8a726af9b5fe40e78a739a2c
|
data/build.gradle
CHANGED
Binary file
|
data/example/config.yml
CHANGED
@@ -3,7 +3,7 @@ exec:
|
|
3
3
|
min_output_tasks: 4
|
4
4
|
in:
|
5
5
|
type: file
|
6
|
-
path_prefix:
|
6
|
+
path_prefix: C:\Users\Abhishek Gupta\Desktop\github\embulk-output-send_email\calendar.csv
|
7
7
|
parser:
|
8
8
|
type: csv
|
9
9
|
columns:
|
@@ -25,19 +25,16 @@ out:
|
|
25
25
|
to:
|
26
26
|
- ankit.kumar@infoobjects.com
|
27
27
|
- abhishek.gupta@infoobjects.com
|
28
|
-
|
29
|
-
|
30
|
-
- ankit.navral@infoobjects.com
|
31
|
-
from: ankit.navral@infoobjects.com
|
32
|
-
# password: 12334
|
28
|
+
from: abhishek.gupta@infoobjects.com
|
29
|
+
password: 1234
|
33
30
|
port: 587
|
34
|
-
username:
|
31
|
+
username: abhishek.gupta@infoobjects.com
|
35
32
|
host: smtp.gmail.com
|
36
33
|
subject: XYZ123
|
37
34
|
# row: 3
|
38
35
|
file_type: html
|
39
36
|
protocol: TLSv1.2
|
40
37
|
auth: true
|
41
|
-
|
38
|
+
# smtp_enable: true
|
42
39
|
|
43
40
|
|
@@ -12,6 +12,9 @@ import javax.mail.internet.InternetAddress;
|
|
12
12
|
import javax.mail.internet.MimeBodyPart;
|
13
13
|
import javax.mail.internet.MimeMessage;
|
14
14
|
import javax.mail.internet.MimeMultipart;
|
15
|
+
import javax.validation.constraints.Null;
|
16
|
+
|
17
|
+
import static ch.qos.logback.core.joran.action.ActionConst.NULL;
|
15
18
|
|
16
19
|
public class SendEmailOutputPlugin
|
17
20
|
implements OutputPlugin {
|
@@ -25,18 +28,19 @@ public class SendEmailOutputPlugin
|
|
25
28
|
@Config("to")
|
26
29
|
public List<String> getTO();
|
27
30
|
|
28
|
-
|
29
31
|
@Config("cc")
|
32
|
+
@ConfigDefault("[]")
|
30
33
|
public List<String> getCC();
|
31
34
|
|
32
35
|
@Config("from")
|
33
36
|
public String getFrom();
|
34
37
|
|
35
38
|
@Config("password")
|
36
|
-
@ConfigDefault("\"
|
39
|
+
@ConfigDefault("\"password\"")
|
37
40
|
public String getPassword();
|
38
41
|
|
39
42
|
@Config("port")
|
43
|
+
@ConfigDefault("\"25\"")
|
40
44
|
public String getPort();
|
41
45
|
|
42
46
|
@Config("subject")
|
@@ -47,10 +51,11 @@ public class SendEmailOutputPlugin
|
|
47
51
|
public boolean getAuth();
|
48
52
|
|
49
53
|
@Config("host")
|
54
|
+
@ConfigDefault("\"smtp.gmail.com\"")
|
50
55
|
public String getHost();
|
51
56
|
|
52
57
|
@Config("protocol")
|
53
|
-
@ConfigDefault("TLSv1.2")
|
58
|
+
@ConfigDefault("\"TLSv1.2\"")
|
54
59
|
public String getProtocol();
|
55
60
|
|
56
61
|
@Config("row")
|
@@ -58,11 +63,11 @@ public class SendEmailOutputPlugin
|
|
58
63
|
public int getRow();
|
59
64
|
|
60
65
|
@Config("username")
|
61
|
-
@ConfigDefault("")
|
66
|
+
@ConfigDefault("\"\"")
|
62
67
|
public String getUserName();
|
63
68
|
|
64
69
|
@Config("smtp_enable")
|
65
|
-
@ConfigDefault("true")
|
70
|
+
@ConfigDefault("\"true\"")
|
66
71
|
public String getSmtpEnable();
|
67
72
|
}
|
68
73
|
|
@@ -200,6 +205,7 @@ public class SendEmailOutputPlugin
|
|
200
205
|
Properties properties = new Properties();
|
201
206
|
properties.put("mail.smtp.auth", task.getAuth());
|
202
207
|
properties.put("mail.smtp.starttls.enable", task.getSmtpEnable());
|
208
|
+
|
203
209
|
properties.put("mail.smtp.ssl.protocols", task.getProtocol());
|
204
210
|
properties.put("mail.smtp.host", task.getHost());
|
205
211
|
properties.put("mail.smtp.port", task.getPort());
|
@@ -223,13 +229,18 @@ public class SendEmailOutputPlugin
|
|
223
229
|
|
224
230
|
private static Message prepareMessage(Session session, String from, List<String> to, List<String> cc, ArrayList<LinkedHashMap<String, Object>> mapList, Schema schema, PluginTask task) {
|
225
231
|
try {
|
232
|
+
String listStringCC=null;
|
226
233
|
String listStringTo = to.stream().map(Object::toString)
|
227
234
|
.collect(Collectors.joining(","));
|
228
|
-
|
229
|
-
|
235
|
+
if(!(cc.size() ==0)) {
|
236
|
+
listStringCC = cc.stream().map(Object::toString)
|
237
|
+
.collect(Collectors.joining(","));
|
238
|
+
}
|
230
239
|
Message message = new MimeMessage(session);
|
231
240
|
message.setFrom(new InternetAddress(from));
|
232
|
-
|
241
|
+
if(listStringCC!=null) {
|
242
|
+
message.addRecipients(Message.RecipientType.CC, InternetAddress.parse(listStringCC));
|
243
|
+
}
|
233
244
|
message.addRecipients(Message.RecipientType.TO, InternetAddress.parse(listStringTo));
|
234
245
|
message.setSubject(task.getSubject());
|
235
246
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-send_email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infoobjects Inc.
|
@@ -53,7 +53,7 @@ files:
|
|
53
53
|
- classpath/activation-1.1.jar
|
54
54
|
- classpath/commons-codec-1.10.jar
|
55
55
|
- classpath/commons-logging-1.2.jar
|
56
|
-
- classpath/embulk-output-send_email-0.1.
|
56
|
+
- classpath/embulk-output-send_email-0.1.3.jar
|
57
57
|
- classpath/google-api-client-1.26.0.jar
|
58
58
|
- classpath/google-api-client-java6-1.26.0.jar
|
59
59
|
- classpath/google-api-services-gmail-v1-rev83-1.23.0.jar
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- classpath/mail-1.4.7.jar
|
71
71
|
- config/checkstyle/checkstyle.xml
|
72
72
|
- config/checkstyle/default.xml
|
73
|
-
- embulk-output-send_email-0.1.0.gem
|
74
73
|
- example/config.yml
|
75
74
|
- gradle/wrapper/gradle-wrapper.jar
|
76
75
|
- gradle/wrapper/gradle-wrapper.properties
|
Binary file
|
Binary file
|