Browse Source

fixed mail envelope from property

drop_old_mail
Stephan Richter 3 years ago
parent
commit
742dd673a9
  1. 2
      pom.xml
  2. 4
      src/main/java/de/srsoftware/widerhall/data/MailingList.java
  3. 8
      src/main/java/de/srsoftware/widerhall/mail/SmtpClient.java

2
pom.xml

@ -6,7 +6,7 @@
<groupId>org.example</groupId> <groupId>org.example</groupId>
<artifactId>Widerhall</artifactId> <artifactId>Widerhall</artifactId>
<version>0.2.44</version> <version>0.2.45</version>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

4
src/main/java/de/srsoftware/widerhall/data/MailingList.java

@ -87,7 +87,7 @@ public class MailingList implements MessageHandler, ProblemListener {
this.email = email; this.email = email;
this.name = name; this.name = name;
this.state = state; this.state = state;
this.smtp = new SmtpClient(smtpHost,smtpPort,smtpUser,smtpPass); this.smtp = new SmtpClient(smtpHost,smtpPort,smtpUser,smtpPass,email);
this.imap = new ImapClient(imapHost,imapPort,imapUser,imapPass,inbox,this); this.imap = new ImapClient(imapHost,imapPort,imapUser,imapPass,inbox,this);
} }
@ -721,7 +721,7 @@ public class MailingList implements MessageHandler, ProblemListener {
this.email = email; this.email = email;
} }
this.name = name; this.name = name;
smtp = new SmtpClient(smtpHost,smtpPort,smtpUser,smtpPass); smtp = new SmtpClient(smtpHost,smtpPort,smtpUser,smtpPass,email);
imap = new ImapClient(imapHost,imapPort,imapUser,imapPass,inbox,this); imap = new ImapClient(imapHost,imapPort,imapUser,imapPass,inbox,this);
if (this.hasState(STATE_ENABLED)) imap.start().addListener(this); if (this.hasState(STATE_ENABLED)) imap.start().addListener(this);
} }

8
src/main/java/de/srsoftware/widerhall/mail/SmtpClient.java

@ -1,5 +1,6 @@
package de.srsoftware.widerhall.mail; package de.srsoftware.widerhall.mail;
import com.sun.mail.imap.protocol.ENVELOPE;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -15,19 +16,21 @@ public class SmtpClient {
private static final String HOST = "mail.smtp.host"; private static final String HOST = "mail.smtp.host";
private static final String PORT = "mail.smtp.port"; private static final String PORT = "mail.smtp.port";
private static final String AUTH = "mail.smtp.auth"; private static final String AUTH = "mail.smtp.auth";
private static final String ENVELOPE_FROM = "mail.smtp.from";
private static final String SSL = "mail.smtp.ssl.enable"; private static final String SSL = "mail.smtp.ssl.enable";
private static final String UTF8 = "UTF-8"; private static final String UTF8 = "UTF-8";
private final String host,password,username; private final String host,password,username,from;
private final int port; private final int port;
private boolean forwardUsingListAddress = true; private boolean forwardUsingListAddress = true;
private Session session; private Session session;
public SmtpClient(String host, int port, String username, String password){ public SmtpClient(String host, int port, String username, String password, String envelopeFrom){
this.username = username; this.username = username;
this.password = password; this.password = password;
this.host = host; this.host = host;
this.port = port; this.port = port;
this.from = envelopeFrom;
} }
@ -86,6 +89,7 @@ public class SmtpClient {
props.put(PORT, port); props.put(PORT, port);
props.put(AUTH, true); props.put(AUTH, true);
props.put(SSL, true); props.put(SSL, true);
props.put(ENVELOPE_FROM,from);
session = Session.getInstance(props); session = Session.getInstance(props);
LOG.debug("Created new session: {}", session); LOG.debug("Created new session: {}", session);

Loading…
Cancel
Save