Merge branch 'main' into lang_de
This commit is contained in:
@@ -6,7 +6,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.mail.*;
|
||||
import javax.mail.internet.*;
|
||||
import javax.ws.rs.HEAD;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -63,7 +62,7 @@ public class SmtpClient {
|
||||
MimeMultipart multipart = new MimeMultipart();
|
||||
if (forwardAsAttachment){
|
||||
MimeBodyPart bodyPart = new MimeBodyPart();
|
||||
bodyPart.setText("Die weitergeleitete Nachricht findest du im Anhang dieser E-Mail!\n");
|
||||
bodyPart.setText("Find the forwarded message in the attachment(s)!\n");
|
||||
multipart.addBodyPart(bodyPart);
|
||||
|
||||
// create another body part to contain the message to be forwarded
|
||||
@@ -82,6 +81,9 @@ public class SmtpClient {
|
||||
send(forward);
|
||||
}
|
||||
|
||||
public String host() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public SmtpClient login(){
|
||||
if (session == null) {
|
||||
@@ -93,11 +95,25 @@ public class SmtpClient {
|
||||
props.put(ENVELOPE_FROM,from);
|
||||
|
||||
session = Session.getInstance(props);
|
||||
LOG.debug("Neue Session erzeugt: {}", session);
|
||||
LOG.debug("Created new session: {}", session);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public String password() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public int port() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void send(Message message) throws MessagingException {
|
||||
LOG.debug("Versende Mail…");
|
||||
Transport.send(message,username,password);
|
||||
LOG.debug("…versendet");
|
||||
}
|
||||
|
||||
public void send(String senderAdress, String senderName, String receivers, String subject, String content) throws MessagingException, UnsupportedEncodingException {
|
||||
login();
|
||||
MimeMessage message = new MimeMessage(session);
|
||||
@@ -114,27 +130,7 @@ public class SmtpClient {
|
||||
send(message);
|
||||
}
|
||||
|
||||
public void send(Message message) throws MessagingException {
|
||||
LOG.debug("Versende Mail…");
|
||||
Transport.send(message,username,password);
|
||||
LOG.debug("…versendet");
|
||||
|
||||
}
|
||||
|
||||
public String host() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public int port() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public String username() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String password() {
|
||||
return password;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user