Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pdstask
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
pdstask
Commits
e68f44d9
Commit
e68f44d9
authored
Dec 03, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
a1e2f276
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
17 deletions
+28
-17
MailConfig.java
src/main/java/com/egolm/pds/bean/MailConfig.java
+7
-0
EmailService.java
src/main/java/com/egolm/pds/service/EmailService.java
+18
-16
application.yml
src/main/resources/application.yml
+3
-1
No files found.
src/main/java/com/egolm/pds/bean/MailConfig.java
View file @
e68f44d9
...
...
@@ -14,6 +14,7 @@ public class MailConfig {
private
String
from
;
private
String
username
;
private
String
password
;
private
boolean
open
;
public
List
<
String
>
getTo
()
{
return
to
;
}
...
...
@@ -50,4 +51,10 @@ public class MailConfig {
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
boolean
isOpen
()
{
return
open
;
}
public
void
setOpen
(
boolean
open
)
{
this
.
open
=
open
;
}
}
src/main/java/com/egolm/pds/service/EmailService.java
View file @
e68f44d9
...
...
@@ -30,23 +30,25 @@ public class EmailService {
}
public
void
sendForsync
(
int
tryCount
,
String
subject
,
String
content
)
{
try
{
String
host
=
config
.
getHost
();
Integer
port
=
config
.
getPort
();
String
username
=
config
.
getUsername
();
String
password
=
config
.
getPassword
();
String
from
=
config
.
getFrom
();
List
<
String
>
to
=
config
.
getTo
();
MailUtil
.
sendBySmtp
(
host
,
port
,
true
,
username
,
password
,
from
,
subject
,
content
,
null
,
to
.
toArray
(
new
String
[
to
.
size
()]));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(
tryCount
>
0
)
{
try
{
Thread
.
sleep
(
1000L
*
60
*
5
);
}
catch
(
InterruptedException
e1
)
{
e1
.
printStackTrace
();
if
(
config
.
isOpen
())
{
try
{
String
host
=
config
.
getHost
();
Integer
port
=
config
.
getPort
();
String
username
=
config
.
getUsername
();
String
password
=
config
.
getPassword
();
String
from
=
config
.
getFrom
();
List
<
String
>
to
=
config
.
getTo
();
MailUtil
.
sendBySmtp
(
host
,
port
,
true
,
username
,
password
,
from
,
subject
,
content
,
null
,
to
.
toArray
(
new
String
[
to
.
size
()]));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(
tryCount
>
0
)
{
try
{
Thread
.
sleep
(
1000L
*
60
*
5
);
}
catch
(
InterruptedException
e1
)
{
e1
.
printStackTrace
();
}
this
.
sendForsync
(--
tryCount
,
subject
,
content
);
}
this
.
sendForsync
(--
tryCount
,
subject
,
content
);
}
}
}
...
...
src/main/resources/application.yml
View file @
e68f44d9
...
...
@@ -2,4 +2,6 @@ server:
port
:
9090
spring
:
profiles
:
active
:
dev
\ No newline at end of file
active
:
dev
mail
:
open
:
false
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment