Author: norman
Date: Sun Dec 17 22:51:21 2006
New Revision: 488138
URL: http://svn.apache.org/viewvc?view=rev&rev=488138
Log:
Revert fix i commited for heloname usage in RemoteDelivery. This fix is not
needed cause its possible to set the heloname with
<mail.smtp.localhost>some.host.name</mail.smtp.localhost> . Backport needed
changes from trunk. (Thx Stefano for reporting). See JAMES-735
Modified:
james/server/branches/v2.3/src/conf/james-config.xml
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
Modified: james/server/branches/v2.3/src/conf/james-config.xml
URL:
http://svn.apache.org/viewvc/james/server/branches/v2.3/src/conf/james-config.xml?view=diff&rev=488138&r1=488137&r2=488138
==============================================================================
--- james/server/branches/v2.3/src/conf/james-config.xml (original)
+++ james/server/branches/v2.3/src/conf/james-config.xml Sun Dec 17 22:51:21
2006
@@ -590,12 +590,6 @@
<gateway> otherserver.mydomain.com </gateway>
<gatewayPort>25</gatewayPort>
-->
-
- <!-- The name which will be used as HELO. If not set the heloName
configured in James block -->
- <!-- will be used. -->
- <!--
- <helloName> myMailServer </helloName>
- -->
</mailet>
</processor>
Modified:
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL:
http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?view=diff&rev=488138&r1=488137&r2=488138
==============================================================================
---
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
(original)
+++
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
Sun Dec 17 22:51:21 2006
@@ -221,9 +221,7 @@
private Perl5Matcher delayTimeMatcher; //matcher use at init time to parse
delaytime parameters
private MultipleDelayFilter delayFilter = new MultipleDelayFilter
();//used by accept to selcet the next mail ready for processing
-
-
- private String helloName = null;
+ private Properties defprops = new Properties(); // default properties for
the javamail Session
/**
* Initialize the mailet
@@ -360,10 +358,16 @@
log("Invalid bind setting (" + bindAddress + "): " + e.toString());
}
- helloName = getInitParameter("helloName");
-
+ Iterator i = getInitParameterNames();
+ while (i.hasNext()) {
+ String name = (String) i.next();
+ if (name.startsWith("mail.")) {
+ defprops.put(name,getInitParameter(name));
+ }
+
+ }
}
-
+
/*
* private method to log the extended SendFailedException introduced in
JavaMail 1.3.2.
*/
@@ -1038,40 +1042,26 @@
* there are any
*/
public void run() {
+
+ /* TODO: CHANGE ME!!! The problem is that we need to wait for James to
+ * finish initializing. We expect the HELLO_NAME to be put into
+ * the MailetContext, but in the current configuration we get
+ * started before the SMTP Server, which establishes the value.
+ * Since there is no contractual guarantee that there will be a
+ * HELLO_NAME value, we can't just wait for it. As a temporary
+ * measure, I'm inserting this philosophically unsatisfactory
+ * fix.
+ */
+ long stop = System.currentTimeMillis() + 60000;
+ while ((getMailetContext().getAttribute(Constants.HELLO_NAME) == null)
+ && stop > System.currentTimeMillis()) {
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ignored) {} // wait for James to finish
initializing
+ }
+
//Checks the pool and delivers a mail message
Properties props = new Properties();
-
- if (helloName == null) {
- /* TODO: CHANGE ME!!! The problem is that we need to wait for
James to
- * finish initializing. We expect the HELLO_NAME to be put into
- * the MailetContext, but in the current configuration we get
- * started before the SMTP Server, which establishes the value.
- * Since there is no contractual guarantee that there will be a
- * HELLO_NAME value, we can't just wait for it. As a temporary
- * measure, I'm inserting this philosophically unsatisfactory
- * fix.
- */
- long stop = System.currentTimeMillis() + 60000;
- while ((getMailetContext().getAttribute(Constants.HELLO_NAME) ==
null)
- && stop > System.currentTimeMillis()) {
- try {
- Thread.sleep(1000);
- } catch (Exception ignored) {} // wait for James to finish
initializing
- }
-
- String defaultDomain = (String)
getMailetContext().getAttribute(Constants.HELLO_NAME);
- if (defaultDomain != null) {
- props.put("mail.smtp.localhost", defaultDomain);
- } else {
- defaultDomain = (String)
getMailetContext().getAttribute(Constants.DEFAULT_DOMAIN);
- if (defaultDomain != null) {
- props.put("mail.smtp.localhost", defaultDomain);
- }
- }
- } else {
- props.put("mail.smtp.localhost", helloName);
- }
-
//Not needed for production environment
props.put("mail.debug", "false");
// Reactivated: javamail 1.3.2 should no more have problems with "250
OK"
@@ -1088,6 +1078,17 @@
props.put("mail.smtp.connectiontimeout", connectionTimeout + "");
props.put("mail.smtp.sendpartial",String.valueOf(sendPartial));
+ //Set the hostname we'll use as this server
+ if (getMailetContext().getAttribute(Constants.HELLO_NAME) != null) {
+ props.put("mail.smtp.localhost",
getMailetContext().getAttribute(Constants.HELLO_NAME));
+ }
+ else {
+ String defaultDomain = (String)
getMailetContext().getAttribute(Constants.DEFAULT_DOMAIN);
+ if (defaultDomain != null) {
+ props.put("mail.smtp.localhost", defaultDomain);
+ }
+ }
+
if (isBindUsed) {
// undocumented JavaMail 1.2 feature, smtp transport will use
// our socket factory, which will also set the local address
@@ -1101,6 +1102,8 @@
props.put("mail.smtp.auth","true");
}
+ props.putAll(defprops);
+
Session session = Session.getInstance(props, null);
try {
while (!Thread.interrupted() && !destroyed) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]