You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2020/12/16 06:52:15 UTC
[james-project] 08/08: JAMES-3431 Tests for DSN hooks
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit f6d0f9cf9ec5ffca9c48369838e40f240560b312
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Dec 10 12:42:27 2020 +0700
JAMES-3431 Tests for DSN hooks
---
.../dsn/{DSNHeloHook.java => DSNEhloHook.java} | 2 +-
.../java/org/apache/james/smtpserver/DSNTest.java | 375 +++++++++++++++++++++
.../apache/james/smtpserver/SMTPServerTest.java | 2 +-
.../src/test/resources/smtpserver-dsn.xml | 50 +++
4 files changed, 427 insertions(+), 2 deletions(-)
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/dsn/DSNHeloHook.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/dsn/DSNEhloHook.java
similarity index 97%
rename from server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/dsn/DSNHeloHook.java
rename to server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/dsn/DSNEhloHook.java
index 11f0c26..a10a340 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/dsn/DSNHeloHook.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/dsn/DSNEhloHook.java
@@ -27,7 +27,7 @@ import org.apache.james.protocols.smtp.hook.HookResult;
import com.google.common.collect.ImmutableSet;
-public class DSNHeloHook implements HeloHook {
+public class DSNEhloHook implements HeloHook {
@Override
public Set<String> implementedEsmtpFeatures() {
return ImmutableSet.of("DSN");
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/DSNTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/DSNTest.java
new file mode 100644
index 0000000..3c38d88
--- /dev/null
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/DSNTest.java
@@ -0,0 +1,375 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.smtpserver;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.apache.mailet.DsnParameters.Notify.DELAY;
+import static org.apache.mailet.DsnParameters.Notify.FAILURE;
+import static org.apache.mailet.DsnParameters.Notify.SUCCESS;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.Base64;
+import java.util.EnumSet;
+
+import org.apache.commons.configuration2.BaseHierarchicalConfiguration;
+import org.apache.commons.net.smtp.SMTPClient;
+import org.apache.james.core.Domain;
+import org.apache.james.core.MailAddress;
+import org.apache.james.core.Username;
+import org.apache.james.dnsservice.api.DNSService;
+import org.apache.james.dnsservice.api.InMemoryDNSService;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.lib.DomainListConfiguration;
+import org.apache.james.domainlist.memory.MemoryDomainList;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.mailrepository.api.MailRepositoryStore;
+import org.apache.james.mailrepository.api.Protocol;
+import org.apache.james.mailrepository.memory.MailRepositoryStoreConfiguration;
+import org.apache.james.mailrepository.memory.MemoryMailRepository;
+import org.apache.james.mailrepository.memory.MemoryMailRepositoryStore;
+import org.apache.james.mailrepository.memory.MemoryMailRepositoryUrlStore;
+import org.apache.james.mailrepository.memory.SimpleMailRepositoryLoader;
+import org.apache.james.metrics.api.Metric;
+import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.metrics.tests.RecordingMetricFactory;
+import org.apache.james.protocols.api.utils.ProtocolServerUtils;
+import org.apache.james.protocols.lib.mock.MockProtocolHandlerLoader;
+import org.apache.james.queue.api.MailQueueFactory;
+import org.apache.james.queue.api.RawMailQueueItemDecoratorFactory;
+import org.apache.james.queue.memory.MemoryMailQueueFactory;
+import org.apache.james.rrt.api.AliasReverseResolver;
+import org.apache.james.rrt.api.CanSendFrom;
+import org.apache.james.rrt.api.RecipientRewriteTable;
+import org.apache.james.rrt.api.RecipientRewriteTableConfiguration;
+import org.apache.james.rrt.lib.AliasReverseResolverImpl;
+import org.apache.james.rrt.lib.CanSendFromImpl;
+import org.apache.james.rrt.memory.MemoryRecipientRewriteTable;
+import org.apache.james.server.core.configuration.Configuration;
+import org.apache.james.server.core.configuration.FileConfigurationProvider;
+import org.apache.james.server.core.filesystem.FileSystemImpl;
+import org.apache.james.smtpserver.netty.SMTPServer;
+import org.apache.james.smtpserver.netty.SmtpMetricsImpl;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.user.memory.MemoryUsersRepository;
+import org.apache.mailet.DsnParameters;
+import org.apache.mailet.Mail;
+import org.assertj.core.api.SoftAssertions;
+import org.jboss.netty.util.HashedWheelTimer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.TypeLiteral;
+
+public class DSNTest {
+ public static final String LOCAL_DOMAIN = "example.local";
+ public static final Username BOB = Username.of("bob@localhost");
+ public static final String PASSWORD = "bobpwd";
+
+ protected HashedWheelTimer hashedWheelTimer;
+ protected MemoryDomainList domainList;
+ protected MemoryUsersRepository usersRepository;
+ protected SMTPServerTest.AlterableDNSServer dnsServer;
+ protected MemoryMailRepositoryStore mailRepositoryStore;
+ protected FileSystemImpl fileSystem;
+ protected Configuration configuration;
+ protected MockProtocolHandlerLoader chain;
+ protected MemoryMailQueueFactory queueFactory;
+ protected MemoryMailQueueFactory.MemoryCacheableMailQueue queue;
+
+ private SMTPServer smtpServer;
+
+ @Before
+ public void setUp() throws Exception {
+ domainList = new MemoryDomainList(new InMemoryDNSService()
+ .registerMxRecord(Domain.LOCALHOST.asString(), "127.0.0.1")
+ .registerMxRecord(Domain.LOCALHOST.asString(), "127.0.0.1")
+ .registerMxRecord(LOCAL_DOMAIN, "127.0.0.1")
+ .registerMxRecord("examplebis.local", "127.0.0.1")
+ .registerMxRecord("127.0.0.1", "127.0.0.1"));
+ domainList.configure(DomainListConfiguration.DEFAULT);
+
+ domainList.addDomain(Domain.of(LOCAL_DOMAIN));
+ domainList.addDomain(Domain.of("examplebis.local"));
+ usersRepository = MemoryUsersRepository.withVirtualHosting(domainList);
+ usersRepository.addUser(BOB, PASSWORD);
+
+ createMailRepositoryStore();
+
+ setUpFakeLoader();
+ hashedWheelTimer = new HashedWheelTimer();
+ setUpSMTPServer();
+ }
+
+ protected void createMailRepositoryStore() throws Exception {
+ configuration = Configuration.builder()
+ .workingDirectory("../")
+ .configurationFromClasspath()
+ .build();
+ fileSystem = new FileSystemImpl(configuration.directories());
+ MemoryMailRepositoryUrlStore urlStore = new MemoryMailRepositoryUrlStore();
+
+ MailRepositoryStoreConfiguration configuration = MailRepositoryStoreConfiguration.forItems(
+ new MailRepositoryStoreConfiguration.Item(
+ ImmutableList.of(new Protocol("memory")),
+ MemoryMailRepository.class.getName(),
+ new BaseHierarchicalConfiguration()));
+
+ mailRepositoryStore = new MemoryMailRepositoryStore(urlStore, new SimpleMailRepositoryLoader(), configuration);
+ mailRepositoryStore.init();
+ }
+
+ protected SMTPServer createSMTPServer(SmtpMetricsImpl smtpMetrics) {
+ return new SMTPServer(smtpMetrics);
+ }
+
+ protected void setUpSMTPServer() {
+ SmtpMetricsImpl smtpMetrics = mock(SmtpMetricsImpl.class);
+ when(smtpMetrics.getCommandsMetric()).thenReturn(mock(Metric.class));
+ when(smtpMetrics.getConnectionMetric()).thenReturn(mock(Metric.class));
+ smtpServer = createSMTPServer(smtpMetrics);
+ smtpServer.setDnsService(dnsServer);
+ smtpServer.setFileSystem(fileSystem);
+ smtpServer.setHashWheelTimer(hashedWheelTimer);
+ smtpServer.setProtocolHandlerLoader(chain);
+ }
+
+ protected void setUpFakeLoader() {
+ dnsServer = new SMTPServerTest.AlterableDNSServer();
+
+ MemoryRecipientRewriteTable rewriteTable = new MemoryRecipientRewriteTable();
+ rewriteTable.setConfiguration(RecipientRewriteTableConfiguration.DEFAULT_ENABLED);
+ AliasReverseResolver aliasReverseResolver = new AliasReverseResolverImpl(rewriteTable);
+ CanSendFrom canSendFrom = new CanSendFromImpl(rewriteTable, aliasReverseResolver);
+ queueFactory = new MemoryMailQueueFactory(new RawMailQueueItemDecoratorFactory());
+ queue = queueFactory.createQueue(MailQueueFactory.SPOOL);
+
+ chain = MockProtocolHandlerLoader.builder()
+ .put(binder -> binder.bind(DomainList.class).toInstance(domainList))
+ .put(binder -> binder.bind(new TypeLiteral<MailQueueFactory<?>>() {}).toInstance(queueFactory))
+ .put(binder -> binder.bind(RecipientRewriteTable.class).toInstance(rewriteTable))
+ .put(binder -> binder.bind(CanSendFrom.class).toInstance(canSendFrom))
+ .put(binder -> binder.bind(FileSystem.class).toInstance(fileSystem))
+ .put(binder -> binder.bind(MailRepositoryStore.class).toInstance(mailRepositoryStore))
+ .put(binder -> binder.bind(DNSService.class).toInstance(dnsServer))
+ .put(binder -> binder.bind(UsersRepository.class).toInstance(usersRepository))
+ .put(binder -> binder.bind(MetricFactory.class).to(RecordingMetricFactory.class))
+ .build();
+ }
+
+ @After
+ public void tearDown() {
+ smtpServer.destroy();
+ hashedWheelTimer.stop();
+ }
+
+ @Test
+ public void ehloShouldAdvertiseDsnExtension() throws Exception {
+ smtpServer.configure(FileConfigurationProvider.getConfig(
+ ClassLoader.getSystemResourceAsStream("smtpserver-dsn.xml")));
+ smtpServer.init();
+
+ SMTPClient smtpProtocol = new SMTPClient();
+ InetSocketAddress bindedAddress = new ProtocolServerUtils(smtpServer).retrieveBindedAddress();
+ smtpProtocol.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
+ authenticate(smtpProtocol);
+ smtpProtocol.sendCommand("EHLO localhost");
+
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(smtpProtocol.getReplyCode()).isEqualTo(250);
+ softly.assertThat(smtpProtocol.getReplyString()).contains("250 DSN");
+ });
+ }
+
+ private void authenticate(SMTPClient smtpProtocol) throws IOException {
+ smtpProtocol.sendCommand("AUTH PLAIN");
+ smtpProtocol.sendCommand(Base64.getEncoder().encodeToString(("\0" + BOB.asString() + "\0" + PASSWORD + "\0").getBytes(UTF_8)));
+ assertThat(smtpProtocol.getReplyCode())
+ .as("authenticated")
+ .isEqualTo(235);
+ }
+
+ @Test
+ public void dsnParametersShouldBeSetOnTheFinalEmail() throws Exception {
+ smtpServer.configure(FileConfigurationProvider.getConfig(
+ ClassLoader.getSystemResourceAsStream("smtpserver-dsn.xml")));
+ smtpServer.init();
+
+ SMTPClient smtpProtocol = new SMTPClient();
+ InetSocketAddress bindedAddress = new ProtocolServerUtils(smtpServer).retrieveBindedAddress();
+ smtpProtocol.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
+ authenticate(smtpProtocol);
+
+ smtpProtocol.sendCommand("EHLO localhost");
+ smtpProtocol.sendCommand("MAIL FROM: <bo...@localhost> RET=HDRS ENVID=QQ314159");
+ smtpProtocol.sendCommand("RCPT TO:<rc...@localhost> NOTIFY=SUCCESS,FAILURE,DELAY ORCPT=rfc822;orcpt@localhost");
+ smtpProtocol.sendShortMessageData("Subject: test mail\r\n\r\nTest body testSimpleMailSendWithDSN\r\n.\r\n");
+
+ Mail lastMail = queue.getLastMail();
+ assertThat(lastMail.dsnParameters())
+ .contains(DsnParameters.builder()
+ .envId(DsnParameters.EnvId.of("QQ314159"))
+ .ret(DsnParameters.Ret.HDRS)
+ .addRcptParameter(new MailAddress("rcpt@localhost"), DsnParameters.RecipientDsnParameters.of(
+ EnumSet.of(SUCCESS, FAILURE, DELAY),
+ new MailAddress("orcpt@localhost")
+ )).build().get());
+ }
+
+ @Test
+ public void multipleRecipientsShouldBeSupported() throws Exception {
+ smtpServer.configure(FileConfigurationProvider.getConfig(
+ ClassLoader.getSystemResourceAsStream("smtpserver-dsn.xml")));
+ smtpServer.init();
+
+ SMTPClient smtpProtocol = new SMTPClient();
+ InetSocketAddress bindedAddress = new ProtocolServerUtils(smtpServer).retrieveBindedAddress();
+ smtpProtocol.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
+ authenticate(smtpProtocol);
+
+ smtpProtocol.sendCommand("EHLO localhost");
+ smtpProtocol.sendCommand("MAIL FROM: <bo...@localhost> RET=HDRS ENVID=QQ314159");
+ smtpProtocol.sendCommand("RCPT TO:<rc...@localhost> NOTIFY=SUCCESS,FAILURE,DELAY ORCPT=rfc822;orcpt1@localhost");
+ smtpProtocol.sendCommand("RCPT TO:<rc...@localhost> NOTIFY=SUCCESS,FAILURE,DELAY ORCPT=rfc822;orcpt2@localhost");
+ smtpProtocol.sendCommand("RCPT TO:<rc...@localhost>");
+ smtpProtocol.sendShortMessageData("Subject: test mail\r\n\r\nTest body testSimpleMailSendWithDSN\r\n.\r\n");
+
+ Mail lastMail = queue.getLastMail();
+ assertThat(lastMail.dsnParameters())
+ .contains(DsnParameters.builder()
+ .envId(DsnParameters.EnvId.of("QQ314159"))
+ .ret(DsnParameters.Ret.HDRS)
+ .addRcptParameter(new MailAddress("rcpt1@localhost"), DsnParameters.RecipientDsnParameters.of(
+ EnumSet.of(SUCCESS, FAILURE, DELAY),
+ new MailAddress("orcpt1@localhost")))
+ .addRcptParameter(new MailAddress("rcpt2@localhost"), DsnParameters.RecipientDsnParameters.of(
+ EnumSet.of(SUCCESS, FAILURE, DELAY),
+ new MailAddress("orcpt2@localhost")
+ )).build().get());
+ }
+
+ @Test
+ public void notifyCanBeOmitted() throws Exception {
+ smtpServer.configure(FileConfigurationProvider.getConfig(
+ ClassLoader.getSystemResourceAsStream("smtpserver-dsn.xml")));
+ smtpServer.init();
+
+ SMTPClient smtpProtocol = new SMTPClient();
+ InetSocketAddress bindedAddress = new ProtocolServerUtils(smtpServer).retrieveBindedAddress();
+ smtpProtocol.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
+ authenticate(smtpProtocol);
+
+ smtpProtocol.sendCommand("EHLO localhost");
+ smtpProtocol.sendCommand("MAIL FROM: <bo...@localhost> RET=HDRS ENVID=QQ314159");
+ smtpProtocol.sendCommand("RCPT TO:<rc...@localhost> ORCPT=rfc822;orcpt@localhost");
+ smtpProtocol.sendShortMessageData("Subject: test mail\r\n\r\nTest body testSimpleMailSendWithDSN\r\n.\r\n");
+
+ Mail lastMail = queue.getLastMail();
+ assertThat(lastMail.dsnParameters())
+ .contains(DsnParameters.builder()
+ .envId(DsnParameters.EnvId.of("QQ314159"))
+ .ret(DsnParameters.Ret.HDRS)
+ .addRcptParameter(new MailAddress("rcpt@localhost"), DsnParameters.RecipientDsnParameters.of(
+ new MailAddress("orcpt@localhost")))
+ .build().get());
+ }
+
+ @Test
+ public void orcptCanBeOmitted() throws Exception {
+ smtpServer.configure(FileConfigurationProvider.getConfig(
+ ClassLoader.getSystemResourceAsStream("smtpserver-dsn.xml")));
+ smtpServer.init();
+
+ SMTPClient smtpProtocol = new SMTPClient();
+ InetSocketAddress bindedAddress = new ProtocolServerUtils(smtpServer).retrieveBindedAddress();
+ smtpProtocol.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
+ authenticate(smtpProtocol);
+
+ smtpProtocol.sendCommand("EHLO localhost");
+ smtpProtocol.sendCommand("MAIL FROM: <bo...@localhost> RET=HDRS ENVID=QQ314159");
+ smtpProtocol.sendCommand("RCPT TO:<rc...@localhost> NOTIFY=SUCCESS,FAILURE,DELAY");
+ smtpProtocol.sendShortMessageData("Subject: test mail\r\n\r\nTest body testSimpleMailSendWithDSN\r\n.\r\n");
+
+ Mail lastMail = queue.getLastMail();
+ assertThat(lastMail.dsnParameters())
+ .contains(DsnParameters.builder()
+ .envId(DsnParameters.EnvId.of("QQ314159"))
+ .ret(DsnParameters.Ret.HDRS)
+ .addRcptParameter(new MailAddress("rcpt@localhost"), DsnParameters.RecipientDsnParameters.of(
+ EnumSet.of(SUCCESS, FAILURE, DELAY)))
+ .build().get());
+ }
+
+ @Test
+ public void retCanBeOmitted() throws Exception {
+ smtpServer.configure(FileConfigurationProvider.getConfig(
+ ClassLoader.getSystemResourceAsStream("smtpserver-dsn.xml")));
+ smtpServer.init();
+
+ SMTPClient smtpProtocol = new SMTPClient();
+ InetSocketAddress bindedAddress = new ProtocolServerUtils(smtpServer).retrieveBindedAddress();
+ smtpProtocol.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
+ authenticate(smtpProtocol);
+
+ smtpProtocol.sendCommand("EHLO localhost");
+ smtpProtocol.sendCommand("MAIL FROM: <bo...@localhost> ENVID=QQ314159");
+ smtpProtocol.sendCommand("RCPT TO:<rc...@localhost> NOTIFY=SUCCESS,FAILURE,DELAY ORCPT=rfc822;orcpt@localhost");
+ smtpProtocol.sendShortMessageData("Subject: test mail\r\n\r\nTest body testSimpleMailSendWithDSN\r\n.\r\n");
+
+ Mail lastMail = queue.getLastMail();
+ assertThat(lastMail.dsnParameters())
+ .contains(DsnParameters.builder()
+ .envId(DsnParameters.EnvId.of("QQ314159"))
+ .addRcptParameter(new MailAddress("rcpt@localhost"), DsnParameters.RecipientDsnParameters.of(
+ EnumSet.of(SUCCESS, FAILURE, DELAY),
+ new MailAddress("orcpt@localhost")))
+ .build().get());
+ }
+
+ @Test
+ public void envIdCanBeOmitted() throws Exception {
+ smtpServer.configure(FileConfigurationProvider.getConfig(
+ ClassLoader.getSystemResourceAsStream("smtpserver-dsn.xml")));
+ smtpServer.init();
+
+ SMTPClient smtpProtocol = new SMTPClient();
+ InetSocketAddress bindedAddress = new ProtocolServerUtils(smtpServer).retrieveBindedAddress();
+ smtpProtocol.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
+ authenticate(smtpProtocol);
+
+ smtpProtocol.sendCommand("EHLO localhost");
+ smtpProtocol.sendCommand("MAIL FROM: <bo...@localhost> RET=HDRS");
+ smtpProtocol.sendCommand("RCPT TO:<rc...@localhost> NOTIFY=SUCCESS,FAILURE,DELAY ORCPT=rfc822;orcpt@localhost");
+ smtpProtocol.sendShortMessageData("Subject: test mail\r\n\r\nTest body testSimpleMailSendWithDSN\r\n.\r\n");
+
+ Mail lastMail = queue.getLastMail();
+ assertThat(lastMail.dsnParameters())
+ .contains(DsnParameters.builder()
+ .ret(DsnParameters.Ret.HDRS)
+ .addRcptParameter(new MailAddress("rcpt@localhost"), DsnParameters.RecipientDsnParameters.of(
+ EnumSet.of(SUCCESS, FAILURE, DELAY),
+ new MailAddress("orcpt@localhost")
+ )).build().get());
+ }
+}
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
index f327ffe..9d99f15 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
@@ -103,7 +103,7 @@ public class SMTPServerTest {
public static final String USER_LOCALHOST = "test_user_smtp@localhost";
public static final String USER_LOCAL_DOMAIN = "test_user_smtp@example.local";
- final class AlterableDNSServer implements DNSService {
+ final static class AlterableDNSServer implements DNSService {
private InetAddress localhostByName = null;
diff --git a/server/protocols/protocols-smtp/src/test/resources/smtpserver-dsn.xml b/server/protocols/protocols-smtp/src/test/resources/smtpserver-dsn.xml
new file mode 100644
index 0000000..d6b548e
--- /dev/null
+++ b/server/protocols/protocols-smtp/src/test/resources/smtpserver-dsn.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<!-- Read https://james.apache.org/server/config-smtp-lmtp.html#SMTP_Configuration for further details -->
+
+ <smtpserver enabled="true">
+ <bind>0.0.0.0:0</bind>
+ <connectionBacklog>200</connectionBacklog>
+ <tls socketTLS="false" startTLS="false">
+ <keystore>file://conf/keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <algorithm>SunX509</algorithm>
+ </tls>
+ <connectiontimeout>360</connectiontimeout>
+ <connectionLimit>0</connectionLimit>
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <authRequired>true</authRequired>
+ <verifyIdentity>true</verifyIdentity>
+ <maxmessagesize>0</maxmessagesize>
+ <addressBracketsEnforcement>true</addressBracketsEnforcement>
+ <smtpGreeting>Apache JAMES awesome SMTP Server</smtpGreeting>
+ <handlerchain>
+ <handler class="org.apache.james.smtpserver.dsn.DSNEhloHook"/>
+ <handler class="org.apache.james.smtpserver.dsn.DSNMailParameterHook"/>
+ <handler class="org.apache.james.smtpserver.dsn.DSNRcptParameterHook"/>
+ <handler class="org.apache.james.smtpserver.dsn.DSNMessageHook"/>
+ <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+ </handlerchain>
+ </smtpserver>
+
+
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org