Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ProyectoFinal-Bootcamp
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Baez
ProyectoFinal-Bootcamp
Commits
a8f1b945
Commit
a8f1b945
authored
May 17, 2022
by
Nahuel Mereles Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Empezando con el envio automatico de mails
parent
10e982ec
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
1 deletions
+58
-1
.idea/misc.xml
+2
-1
pom.xml
+6
-0
src/main/java/com/roshka/proyectofinal/SendMail.java
+50
-0
No files found.
.idea/misc.xml
View file @
a8f1b945
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
</list>
</list>
</option>
</option>
</component>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1
7
"
default=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1
_8
"
default=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/out"
/>
<output
url=
"file://$PROJECT_DIR$/out"
/>
</component>
</component>
</project>
</project>
\ No newline at end of file
pom.xml
View file @
a8f1b945
...
@@ -47,6 +47,12 @@
...
@@ -47,6 +47,12 @@
<version>
42.3.5
</version>
<version>
42.3.5
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.sun.mail
</groupId>
<artifactId>
javax.mail
</artifactId>
<version>
1.6.2
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/roshka/proyectofinal/SendMail.java
0 → 100644
View file @
a8f1b945
package
com
.
roshka
.
proyectofinal
;
import
java.util.Properties
;
import
javax.activation.DataHandler
;
import
javax.activation.FileDataSource
;
import
javax.mail.BodyPart
;
import
javax.mail.Message
;
import
javax.mail.MessagingException
;
import
javax.mail.Session
;
import
javax.mail.Transport
;
import
javax.mail.internet.AddressException
;
import
javax.mail.internet.InternetAddress
;
import
javax.mail.internet.MimeBodyPart
;
import
javax.mail.internet.MimeMessage
;
import
javax.mail.internet.MimeMultipart
;
import
javax.swing.*
;
public
class
SendMail
{
public
SendMail
()
{
}
public
void
meetingMail
(
String
postulanteCorreoDestino
)
throws
AddressException
,
MessagingException
{
// emanuel.lugo01@gmail.com
String
correo
=
"nahuelmereles1@gmail.com"
;
String
contra
=
"ozydnpynyoqsowjn"
;
String
correoDestino
=
postulanteCorreoDestino
;
Properties
properties
=
new
Properties
();
properties
.
put
(
"mail.smtp.host"
,
"smtp.gmail.com"
);
properties
.
setProperty
(
"mail.smtp.starttls.enable"
,
"true"
);
properties
.
put
(
"mail.smtp.ssl.trust"
,
"smtp.gmail.com"
);
properties
.
setProperty
(
"mail.smtp.port"
,
"587"
);
properties
.
setProperty
(
"mail.smtp,user"
,
correo
);
properties
.
setProperty
(
"mail.smtp.auth"
,
"true"
);
Session
s
=
Session
.
getDefaultInstance
(
properties
);
MimeMessage
mensaje
=
new
MimeMessage
(
s
);
mensaje
.
setFrom
(
new
InternetAddress
(
correo
));
mensaje
.
addRecipient
(
Message
.
RecipientType
.
TO
,
new
InternetAddress
(
correoDestino
));
mensaje
.
setSubject
(
"Hola que tal soy yo"
);
mensaje
.
setText
(
"Ya funciona?"
);
Transport
transport
=
s
.
getTransport
(
"smtp"
);
transport
.
connect
(
correo
,
contra
);
transport
.
sendMessage
(
mensaje
,
mensaje
.
getAllRecipients
());
transport
.
close
();
JOptionPane
.
showMessageDialog
(
null
,
"Mensaje enviado"
);
}
}
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