Guten Tag,
ich habe ein Problem mit der Apache Commons Mail API.
Die API funktioniert nur wenn ich sie in Intellij IDEA direkt starte aber wenn ich das Projekt exportiere wird keine Email verschickt. Es kommt aber auch kein Fehler!
Maven:
Code:
ich habe ein Problem mit der Apache Commons Mail API.
Die API funktioniert nur wenn ich sie in Intellij IDEA direkt starte aber wenn ich das Projekt exportiere wird keine Email verschickt. Es kommt aber auch kein Fehler!
Maven:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>Freemium - Server</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.10</source>
<target>1.10</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
</project>
Code:
Code:
HtmlEmail email = new HtmlEmail();
email.setHostName(smtpHost);
email.setSmtpPort(25);
email.setAuthenticator(new DefaultAuthenticator(username, password));
email.setSSLOnConnect(false);
email.setFrom(senderAddress);
email.setSubject(subject);
email.setHtmlMsg("<html><body>TEST</body></html>");
email.addTo(recipientsAddress);
email.send();