{"record":{"id":"db8bdb2354b0ac8c","repo":"pentaho/pentaho-kettle","slug":"mail-error-mailserverempty","errorCode":null,"errorMessage":"Mail.Error.MailServerEmpty","messagePattern":"Mail\\.Error\\.MailServerEmpty","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java","lineNumber":158,"sourceCode":"\n      // reply addresses\n      String mailReplyToAddresses = null;\n      if ( data.indexOfReplyToAddresses > -1 ) {\n        mailReplyToAddresses = data.previousRowMeta.getString( r, data.indexOfReplyToAddresses );\n      }\n\n      String contactPerson = null;\n      if ( data.indexOfContactPerson > -1 ) {\n        contactPerson = data.previousRowMeta.getString( r, data.indexOfContactPerson );\n      }\n      String contactPhone = null;\n      if ( data.indexOfContactPhone > -1 ) {\n        contactPhone = data.previousRowMeta.getString( r, data.indexOfContactPhone );\n      }\n\n      String serverName = data.previousRowMeta.getString( r, data.indexOfServer );\n      if ( Utils.isEmpty( serverName ) ) {\n        throw new KettleException( \"Mail.Error.MailServerEmpty\" );\n      }\n      int port = -1;\n      if ( data.indexOfPort > -1 ) {\n        port = Const.toInt( \"\" + data.previousRowMeta.getInteger( r, data.indexOfPort ), -1 );\n      }\n\n      String authUser = null;\n      if ( data.indexOfAuthenticationUser > -1 ) {\n        authUser = data.previousRowMeta.getString( r, data.indexOfAuthenticationUser );\n      }\n      String authPass = null;\n      if ( data.indexOfAuthenticationPass > -1 ) {\n        authPass = Utils.resolvePassword( getParentVariableSpace(), data.previousRowMeta.getString( r, data.indexOfAuthenticationPass ) );\n      }\n\n      String subject = null;\n      if ( data.indexOfSubject > -1 ) {\n        subject = data.previousRowMeta.getString( r, data.indexOfSubject );","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java#L140-L176","documentation":"In Mail.processRow(), the SMTP server name is read from the incoming row at data.indexOfServer; if it is null or empty (Utils.isEmpty) the step throws KettleException 'Mail.Error.MailServerEmpty' because no SMTP host was supplied for sending.","triggerScenarios":"The Mail step is configured with the SMTP server taken from a field, and the current row's server field is empty/null at data.indexOfServer.","commonSituations":"Server column missing values in source data; wrong column mapped as the server field; variable-substituted server field resolves to empty when the variable is undefined; environment switch (no SMTP host recorded for this environment).","solutions":["Set a static SMTP server in the step dialog instead of reading it from the row, if it never varies per row.","Ensure the server field is populated for every row — filter or default empty values upstream.","If using a variable for the server field, define it (kettle.properties / transformation parameter).","Verify the correct column is selected as the 'SMTP server' source field in the dialog."],"exampleFix":"// before\n<server_field>smtp_host</server_field>   <!-- column empty in data -->\n// after: either fill the column upstream or use a static server\n<server>smtp.example.com</server>","handlingStrategy":"validation","validationCode":"// before the Mail step\nFilterRows: smtp_server IS NOT NULL AND LENGTH(TRIM(smtp_server)) > 0\n// or set a constant if the server never varies per row","typeGuard":null,"tryCatchPattern":"try {\n  mail.processRow();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"MailServerEmpty\")) {\n    logError(\"SMTP server missing in row or configuration\");\n  }\n  throw e;\n}","preventionTips":["Prefer a static SMTP server setting when it does not vary per row.","Define SMTP host variables in kettle.properties so substitutions never resolve empty.","Filter rows lacking a server value before the Mail step.","Audit the server field mapping after upstream schema changes."],"tags":["kettle","mail","smtp","empty-field"],"backgroundTag":"empty-required-field","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"}