send emails
This commit is contained in:
+4
-2
@@ -61,12 +61,12 @@ android {
|
|||||||
lint {
|
lint {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
checkReleaseBuilds false
|
checkReleaseBuilds false
|
||||||
}
|
dependencies }
|
||||||
namespace 'com.jens.automation2'
|
namespace 'com.jens.automation2'
|
||||||
buildToolsVersion '36.0.0'
|
buildToolsVersion '36.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
{
|
||||||
implementation 'org.jetbrains:annotations:26.1.0'
|
implementation 'org.jetbrains:annotations:26.1.0'
|
||||||
googlePlayFlavorImplementation 'com.google.firebase:firebase-appindexing:20.0.0'
|
googlePlayFlavorImplementation 'com.google.firebase:firebase-appindexing:20.0.0'
|
||||||
googlePlayFlavorImplementation 'com.google.android.gms:play-services-location:20.0.0'
|
googlePlayFlavorImplementation 'com.google.android.gms:play-services-location:20.0.0'
|
||||||
@@ -77,6 +77,8 @@ dependencies {
|
|||||||
implementation 'com.linkedin.dexmaker:dexmaker:2.28.6'
|
implementation 'com.linkedin.dexmaker:dexmaker:2.28.6'
|
||||||
implementation 'org.apache.commons:commons-lang3:3.20.0'
|
implementation 'org.apache.commons:commons-lang3:3.20.0'
|
||||||
|
|
||||||
|
implementation 'org.simplejavamail:simple-java-mail:9.3.5'
|
||||||
|
|
||||||
//implementation "androidx.security:security-crypto:1.0.0"
|
//implementation "androidx.security:security-crypto:1.0.0"
|
||||||
//implementation "androidx.security:security-identity-credential:1.0.0-alpha02"
|
//implementation "androidx.security:security-identity-credential:1.0.0-alpha02"
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.2'
|
implementation 'androidx.appcompat:appcompat:1.4.2'
|
||||||
|
|||||||
@@ -2675,4 +2675,32 @@ public class Actions
|
|||||||
android.provider.Settings.Secure.putString(context.getContentResolver(), android.provider.Settings.Secure.LOCATION_MODE, String.valueOf(desiredState));
|
android.provider.Settings.Secure.putString(context.getContentResolver(), android.provider.Settings.Secure.LOCATION_MODE, String.valueOf(desiredState));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static sendEmail()
|
||||||
|
{
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.put("mail.smtp.host", smtpHost);
|
||||||
|
props.put("mail.smtp.port", "587");
|
||||||
|
props.put("mail.smtp.auth", "true");
|
||||||
|
props.put("mail.smtp.starttls.enable", "true");
|
||||||
|
props.put("mail.smtp.connectiontimeout", "10000");
|
||||||
|
props.put("mail.smtp.timeout", "10000");
|
||||||
|
|
||||||
|
Session session = Session.getInstance(props, new Authenticator() {
|
||||||
|
@Override
|
||||||
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
|
return new PasswordAuthentication(username, password);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Message message = new MimeMessage(session);
|
||||||
|
message.setFrom(new InternetAddress(fromAddress));
|
||||||
|
message.setRecipients(
|
||||||
|
Message.RecipientType.TO,
|
||||||
|
InternetAddress.parse(recipientAddress)
|
||||||
|
);
|
||||||
|
message.setSubject(subject);
|
||||||
|
message.setText(body);
|
||||||
|
|
||||||
|
Transport.send(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user