{"record":{"id":"788ef273c356c514","repo":"pentaho/pentaho-kettle","slug":"jobgetmailsfrompop-error-connecting","errorCode":null,"errorMessage":"JobGetMailsFromPOP.Error.Connecting","messagePattern":"JobGetMailsFromPOP\\.Error\\.Connecting","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/MailConnection.java","lineNumber":378,"sourceCode":"  public void connect() throws KettleException {\n    if ( log.isDetailed() ) {\n      log.logDetailed( BaseMessages.getString(\n        PKG, \"JobGetMailsFromPOP.Connecting\", this.server, this.username, \"\" + this.port ) );\n    }\n    try {\n      if ( this.protocol == MailConnectionMeta.PROTOCOL_MBOX ) {\n        connectMbox();\n        return;\n      }\n\n      connectToMailServer();\n\n      if ( log.isDetailed() ) {\n        log.logDetailed( BaseMessages.getString(\n          PKG, \"JobGetMailsFromPOP.Connected\", this.server, this.username, \"\" + this.port ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException(\n        BaseMessages.getString( PKG, \"JobGetMailsFromPOP.Error.Connecting\", this.server, this.username, Const\n          .NVL( \"\" + this.port, \"\" ) ), e );\n    }\n  }\n\n  private void connectMbox() throws KettleException {\n    this.mboxMessages = loadMboxMessages();\n    this.mboxConnected = true;\n    this.messages = this.mboxMessages;\n  }\n\n  private void connectToMailServer() throws MessagingException {\n    if ( shouldUseSSLConnection() ) {\n      this.store.connect();\n    } else {\n      connectWithPassword();\n    }\n  }","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/MailConnection.java#L360-L396","documentation":"MailConnection.connect() wraps any exception from establishing the JavaMail Session/Store connection (store.connect) into a KettleException with the JobGetMailsFromPOP.Error.Connecting message, which includes server, username and port. It means the email entry could not log in to the mail server at all — DNS, network, TLS, credentials or protocol problems all land here with the original cause attached.","triggerScenarios":"store.connect() throws: unknown host, connection refused/timeout, STARTSSL/SSL handshake failure, or authentication rejected for the configured server/username/port in connect().","commonSituations":"Wrong POP3/IMAP host or port (995/993 vs 110/143), password changed or account locked, firewall blocks outbound mail ports, mail server requires SSL but 'use SSL' was not checked, self-signed certificates rejected.","solutions":["Verify server hostname, port and use-SSL/use-XOAUTH2 settings in the 'Get mails (POP3/IMAP)' job entry dialog; test with 'telnet host port' or openssl s_client.","Re-enter username/password — POP/IMAP authentication failures surface here.","Check network/firewall/DNS from the Pentaho host; the cause chained in the stack trace names the underlying IOException.","For self-signed servers, import the certificate into the JVM truststore or set MailConnectionMeta SSL/trust properties."],"exampleFix":"// before: wrong port with SSL\nserver=\"mail.example.com\", port=110, useSSL=true\n// after\nserver=\"mail.example.com\", port=995, useSSL=true","handlingStrategy":"try-catch","validationCode":"// before running the job entry\nInetAddress addr = InetAddress.getByName(server); // resolves DNS\ntry (Socket s = new Socket()) { s.connect(new InetSocketAddress(addr, port), 5000); } // port reachable","typeGuard":null,"tryCatchPattern":"try {\n  mailConnection.connect();\n} catch (KettleException e) {\n  // e.getCause() holds the javax.mail.MessagingException/IOException\n  logError(\"Cannot reach \" + server + \":\" + port + \" — \" + e.getCause().getMessage());\n  throw e;\n}","preventionTips":["Validate host/port/SSL settings in the dialog before saving","Test connectivity with telnet/openssl from the Pentaho host","Keep service credentials in a vault and rotate before expiry","Import custom CA certificates into the JVM truststore"],"tags":["javamail","network","connection","kettle","email"],"backgroundTag":"connection-refused","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"}