james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rouaz...@apache.org
Subject [44/50] [abbrv] james-project git commit: JAMES-1877 MailDelivrerToHost interface simplification
Date Tue, 10 Jan 2017 14:18:59 GMT
JAMES-1877 MailDelivrerToHost interface simplification


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/97e23aee
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/97e23aee
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/97e23aee

Branch: refs/heads/master
Commit: 97e23aee67370202e5d3406becc377f9148a31a3
Parents: d004e6e
Author: Benoit Tellier <btellier@linagora.com>
Authored: Wed Dec 7 11:07:46 2016 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Tue Jan 10 18:14:27 2017 +0700

----------------------------------------------------------------------
 .../james/transport/mailets/remoteDelivery/MailDelivrer.java  | 7 +++----
 .../transport/mailets/remoteDelivery/MailDelivrerToHost.java  | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/97e23aee/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrer.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrer.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrer.java
index 1dfc81b..f42a0fc 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrer.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrer.java
@@ -28,7 +28,6 @@ import javax.mail.Address;
 import javax.mail.MessagingException;
 import javax.mail.SendFailedException;
 import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
 
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.TemporaryResolutionException;
@@ -119,7 +118,7 @@ public class MailDelivrer {
             if (!targetServers.hasNext()) {
                 return handleNoTargetServer(mail, host);
             }
-            return doDeliver(mail, mail.getMessage(), InternetAddressConverter.convert(mail.getRecipients()),
targetServers);
+            return doDeliver(mail, InternetAddressConverter.convert(mail.getRecipients()),
targetServers);
         } catch (TemporaryResolutionException e) {
             return logAndReturn(mail, ExecutionResult.temporaryFailure(new MessagingException("Temporary
problem looking " +
                 "up mail server for host: " + host + ".  I cannot determine where to send
this message.")));
@@ -132,12 +131,12 @@ public class MailDelivrer {
     }
 
     @SuppressWarnings("deprecation")
-    private ExecutionResult doDeliver(Mail mail, MimeMessage message, InternetAddress[] addr,
Iterator<HostAddress> targetServers) throws MessagingException {
+    private ExecutionResult doDeliver(Mail mail, InternetAddress[] addr, Iterator<HostAddress>
targetServers) throws MessagingException {
         MessagingException lastError = null;
 
         while (targetServers.hasNext()) {
             try {
-                if (mailDelivrerToHost.tryDeliveryToHost(mail, message, addr, targetServers.next()))
{
+                if (mailDelivrerToHost.tryDeliveryToHost(mail, addr, targetServers.next()))
{
                     return ExecutionResult.success();
                 }
             } catch (SendFailedException sfe) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/97e23aee/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerToHost.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerToHost.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerToHost.java
index 46bd8f9..a9f5758 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerToHost.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerToHost.java
@@ -50,7 +50,7 @@ public class MailDelivrerToHost {
         this.logger = logger;
     }
 
-    public boolean tryDeliveryToHost(Mail mail, MimeMessage message, InternetAddress[] addr,
HostAddress outgoingMailServer) throws MessagingException {
+    public boolean tryDeliveryToHost(Mail mail, InternetAddress[] addr, HostAddress outgoingMailServer)
throws MessagingException {
         Properties props = session.getProperties();
         if (mail.getSender() == null) {
             props.put("mail.smtp.from", "<>");
@@ -74,7 +74,7 @@ public class MailDelivrerToHost {
             transport = (SMTPTransport) session.getTransport(outgoingMailServer);
             transport.setLocalHost( props.getProperty("mail.smtp.localhost", configuration.getHeloNameProvider().getHeloName())
);
             connect(outgoingMailServer, transport);
-            transport.sendMessage(adaptToTransport(message, transport), addr);
+            transport.sendMessage(adaptToTransport(mail.getMessage(), transport), addr);
             logger.debug("Mail (" + mail.getName() + ")  sent successfully to " + outgoingMailServer.getHostName()
+
                 " at " + outgoingMailServer.getHost() + " from " + props.get("mail.smtp.from")
+ " for " + mail.getRecipients());
             return true;


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message