Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
BackEnd-V1-JasperReport
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Anderson Zambrano
BackEnd-V1-JasperReport
Commits
27df2343
Commit
27df2343
authored
May 18, 2023
by
Joel Andres Molina Velez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Envio de correo estático, se agrega un campo a la tabla parameters
parent
a1341af3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
0 deletions
+76
-0
build.gradle
build.gradle
+2
-0
EnvioCorreosController.java
...ilidad/MovilidadWS/controller/EnvioCorreosController.java
+33
-0
ModelParameters.java
...edu/espe/movilidad/MovilidadWS/model/ModelParameters.java
+3
-0
ServiceEmail.java
.../edu/espe/movilidad/MovilidadWS/service/ServiceEmail.java
+26
-0
application-local.properties
src/main/resources/application-local.properties
+12
-0
No files found.
build.gradle
View file @
27df2343
...
...
@@ -24,6 +24,8 @@ dependencies {
implementation
'org.springframework.boot:spring-boot-starter-web'
implementation
'com.lowagie:itext:2.1.7'
implementation
'net.sf.jasperreports:jasperreports:6.9.0'
implementation
'org.springframework.boot:spring-boot-starter-mail'
implementation
'javax.persistence:javax.persistence-api'
compileOnly
'org.projectlombok:lombok'
runtimeOnly
'com.oracle.database.jdbc:ojdbc8'
annotationProcessor
'org.projectlombok:lombok'
...
...
src/main/java/ec/edu/espe/movilidad/MovilidadWS/controller/EnvioCorreosController.java
0 → 100644
View file @
27df2343
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.mail.SimpleMailMessage
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
static
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Constant
.
GlobalConstants
.
V1_API_VERSION
;
@RestController
@CrossOrigin
(
origins
=
"*"
)
@RequestMapping
(
V1_API_VERSION
+
"/xd"
)
public
class
EnvioCorreosController
{
@Autowired
private
JavaMailSender
mail
;
@PostMapping
(
"/enviarCorreo"
)
public
ResponseEntity
<?>
enviarCorreo
(){
SimpleMailMessage
email
=
new
SimpleMailMessage
();
email
.
setTo
(
""
);
//Correo a quien se va a enviar
email
.
setFrom
(
""
);
//Correo del quien envia
email
.
setSubject
(
"Mensaje prueba"
);
email
.
setText
(
"xd"
);
mail
.
send
(
email
);
return
new
ResponseEntity
<>(
true
,
HttpStatus
.
OK
);
}
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/model/ModelParameters.java
View file @
27df2343
...
...
@@ -26,4 +26,7 @@ public class ModelParameters {
@Column
(
name
=
"Puntaje"
,
nullable
=
false
)
private
Integer
puntaje
;
@Column
(
name
=
"Activo"
,
nullable
=
false
)
private
Boolean
activo
;
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/service/ServiceEmail.java
0 → 100644
View file @
27df2343
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.mail.javamail.MimeMessageHelper
;
import
org.springframework.stereotype.Service
;
import
javax.mail.internet.MimeMessage
;
import
javax.transaction.Transactional
;
@Service
@Transactional
public
class
ServiceEmail
{
@Autowired
JavaMailSender
javaMailSender
;
@Autowired
ServiceFile
serviceFile
;
@Value
(
"${spring.mail.username}"
)
private
String
email
;
public
void
sendListEmail
(
String
emailTo
){
}
}
src/main/resources/application-local.properties
View file @
27df2343
...
...
@@ -24,3 +24,15 @@ spring.servlet.multipart.max-file-size=5MB
#establecer el tamao maximo de varios archivos enviados a la vez de una misma solicitud
spring.servlet.multipart.max-request-size
=
5MB
#media.location=mediafiles
#mail
spring.mail.host
=
smtp.gmail.com
spring.mail.port
=
587
spring.mail.protocol
=
smtp
#spring.mail.username =
#spring.mail.password=
spring.mail.properties.mail.smtp.auth
=
true
spring.mail.properties.mail.smtp.starttls.enable
=
true
spring.mail.properties.mail.smtp.ssl.trust
=
smtp.gmail.com
spring.main.allow-circular-references
=
true
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