[go: up one dir, main page]

Menu

#20 specify host name after HELO command

Unstable (example)
open
nobody
None
5
2006-03-23
2006-03-23
rp4
No

Some mailers give a "501" error if a SMTP HELO command is not followed by a hostname. This is a patch to make MailProvider use either the canonical local hostname or "unknown" if it can't determine the local hostname.

--- /home/rpanula/workspace/openreports/src/org/efs/openreports/providers/MailProvider.java 2006-03-23 13:53:25.000000000 -0600
+++ /home/rpanula/workspace/orig/openreports/src/org/efs/openreports/providers/MailProvider.java 2006-03-12 21:14:40.000000000 -0600
@@ -45,7 +45,6 @@
private boolean useMailAuthenticator;
private String userName;
private String password;
- private String canonicalHostName;

public MailProvider() throws ProviderException
{
@@ -58,7 +57,6 @@
useMailAuthenticator = false;
userName = null;
password = null;
- canonicalHostName = null;

ORProperty property = propertiesProvider.getProperty(ORProperty.MAIL_SMTP_HOST);
if (property != null) mailHost = property.getValue();
@@ -72,22 +70,6 @@
property = propertiesProvider.getProperty(ORProperty.MAIL_AUTH_PASSWORD);
if (property != null) password = property.getValue();

- // try to determine this machine's hostname for use in
- // the HELO smtp command
- try
- {
- canonicalHostName = java.net.InetAddress.getLocalHost().getCanonicalHostName();
- }
- catch (java.net.UnknownHostException e)
- {
- log.error(e.toString());
- // throw new ProviderException(e.getMessage());
- // instead of stopping, just use "unknown" as our HELO host
- // in the hopes that the smtp mailer will still allow us to
- // send our mail
- canonicalHostName = "unknown";
- }
-
log.info("Created");
}

@@ -98,7 +80,6 @@
// create a session
Properties mailProps = new Properties();
mailProps.put("mail.smtp.host", mailHost);
- mailProps.put("mail.smtp.localhost", canonicalHostName);

Session mailSession = null;
if (useMailAuthenticator)

Discussion

  • rp4

    rp4 - 2006-03-23

    Logged In: YES
    user_id=1454214

    sorry, here's a patch file for cvs version

     
  • rp4

    rp4 - 2006-03-23
     

Log in to post a comment.