Skip to content

Commit

Permalink
https://github.com/scouter-project/scouter-plugin-server-alert-email/…
Browse files Browse the repository at this point in the history
…issues/12
  • Loading branch information
nices96 committed Apr 27, 2018
1 parent a219395 commit fff2b90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* **_ext\_plugin\_email\_level_** : 수신 레벨(0 : INFO, 1 : WARN, 2 : ERROR, 3 : FATAL) - 기본 값은 0
* **_ext\_plugin\_email\_smtp_hostname_** : SMTP 서버의 IP 또는 Domain - 기본 값은 smtp.gmail.com
* **_ext\_plugin\_email\_smtp_port_** : SMTP Port - 기본 값은 587
* **_ext\_plugin\_email\_smtpauth_enabled_** : SMTP 인증 사용 여부 - 기본 값은 true
* **_ext\_plugin\_email\_username_** : Email 사용자 계정
* **_ext\_plugin\_email\_password_** : Email 사용자 비밀번호
* **_ext\_plugin\_email\_ssl_enabled_** : SSL 사용 여부 - 기본 값은 true
Expand All @@ -42,6 +43,7 @@ ext_plugin_email_debug=true
ext_plugin_email_level=0
ext_plugin_email_smtp_hostname=smtp.gmail.com
ext_plugin_email_smtp_port=587
ext_plugin_email_smtpauth_enabled=true
[email protected]
ext_plugin_email_password=password
ext_plugin_email_ssl_enabled=true
Expand Down
5 changes: 4 additions & 1 deletion src/scouter/plugin/server/alert/email/EmailPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public void run() {
// Get server configurations for email
String hostname = conf.getValue("ext_plugin_email_smtp_hostname", "smtp.gmail.com");
int port = conf.getInt("ext_plugin_email_smtp_port", 587);
boolean authEnabled = conf.getBoolean("ext_plugin_email_smtpauth_enabled", true);
String username = conf.getValue("ext_plugin_email_username");
String password = conf.getValue("ext_plugin_email_password");
boolean sslEnabled = conf.getBoolean("ext_plugin_email_ssl_enabled", true);
Expand Down Expand Up @@ -219,7 +220,9 @@ public void run() {
email.setSmtpPort(port);
}

email.setAuthenticator(new DefaultAuthenticator(username, password));
if (authEnabled) {
email.setAuthenticator(new DefaultAuthenticator(username, password));
}
email.setStartTLSEnabled(tlsEnabled);
email.setFrom(from);
email.setSubject(subject);
Expand Down

0 comments on commit fff2b90

Please sign in to comment.