{"record":{"id":"07ac304edf1b484a","repo":"pentaho/pentaho-kettle","slug":"mailvalidator-nomatchname","errorCode":null,"errorMessage":"MailValidator.NoMatchName","messagePattern":"MailValidator\\.NoMatchName","errorType":"exception","errorClass":"NamingException","httpStatus":null,"severity":"error","filePath":"plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidation.java","lineNumber":104,"sourceCode":"    wr.flush();\n\n    return;\n  }\n\n  private static ArrayList<String> getMX( String hostName ) throws NamingException {\n    // Perform a DNS lookup for MX records in the domain\n    Hashtable<String, String> env = new Hashtable<String, String>();\n    env.put( \"java.naming.factory.initial\", \"com.sun.jndi.dns.DnsContextFactory\" );\n    DirContext ictx = new InitialDirContext( env );\n    Attributes attrs = ictx.getAttributes( hostName, new String[] { \"MX\" } );\n    Attribute attr = attrs.get( \"MX\" );\n\n    // if we don't have an MX record, try the machine itself\n    if ( ( attr == null ) || ( attr.size() == 0 ) ) {\n      attrs = ictx.getAttributes( hostName, new String[] { \"A\" } );\n      attr = attrs.get( \"A\" );\n      if ( attr == null ) {\n        throw new NamingException( BaseMessages.getString( PKG, \"MailValidator.NoMatchName\", hostName ) );\n      }\n    }\n\n    // Huzzah! we have machines to try. Return them as an array list\n    // NOTE: We SHOULD take the preference into account to be absolutely\n    // correct. This is left as an exercise for anyone who cares.\n    ArrayList<String> res = new ArrayList<String>();\n    NamingEnumeration<?> en = attr.getAll();\n\n    while ( en.hasMore() ) {\n      String x = (String) en.next();\n      String[] f = x.split( \" \" );\n      if ( f[1].endsWith( \".\" ) ) {\n        f[1] = f[1].substring( 0, ( f[1].length() - 1 ) );\n      }\n      res.add( f[1] );\n    }\n    return res;","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidation.java#L86-L122","documentation":"MailValidation.getMX() throws this NamingException when performing SMTP validation: if a domain has no MX records, it falls back to querying the 'A' record for the host, and if that lookup also returns null it means DNS knows nothing about the host. The message includes the hostName that failed to resolve.","triggerScenarios":"SMTP check enabled on the Mail Validator step; DNS lookup of MX records returns empty and the subsequent 'A' record lookup via JNDI DirContext returns null for the email domain.","commonSituations":"Email address contains a misspelled or nonexistent domain; DNS server unreachable or misconfigured; domain exists but has neither MX nor A records; testing in an isolated network without DNS access.","solutions":["Verify the email domain actually exists (e.g. `nslookup -type=MX domain`).","Check DNS server configuration / resolv.conf on the machine running the transformation.","Disable SMTP check in the Mail Validator step if you only need syntax validation.","Ensure the JVM has network access and correct dnsjava/JNDI provider settings."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before enabling SMTP check, verify DNS resolution of the domain\nString domain = email.substring( email.indexOf( '@' ) + 1 );\njavax.naming.directory.DirContext ictx = ...;\ntry {\n  ictx.getAttributes( domain, new String[] { \"MX\", \"A\" } );\n} catch ( NamingException e ) {\n  fail( \"Domain not resolvable: \" + domain );\n}","typeGuard":null,"tryCatchPattern":"try {\n  valid = MailValidation.isAddressValid( email );\n} catch ( NamingException e ) {\n  // treat as 'cannot validate' rather than invalid address\n  log.logBasic( \"DNS lookup failed for domain: \" + e.getMessage() );\n  valid = false;\n}","preventionTips":["Pre-validate email domains with a DNS lookup before SMTP check.","Test DNS from the transformation host (nslookup/dig).","Only enable SMTP check when network + DNS access is guaranteed.","Sanitize/validate email syntax before domain lookups."],"tags":["dns","network","smtp","email-validation"],"backgroundTag":"resource-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}