{"record":{"id":"ef6c51e103bd6e63","repo":"knadh/listmonk","slug":"unknown-smtp-auth-type-s","errorCode":null,"errorMessage":"unknown SMTP auth type '%s'","messagePattern":"unknown SMTP auth type '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/messenger/email/email.go","lineNumber":83,"sourceCode":"\te := &Emailer{\n\t\tname:  name,\n\t\tpools: make(map[string][]*Server),\n\t}\n\n\tfor _, srv := range servers {\n\t\ts := srv\n\n\t\tvar auth smtp.Auth\n\t\tswitch s.AuthProtocol {\n\t\tcase \"cram\":\n\t\t\tauth = smtp.CRAMMD5Auth(s.Username, s.Password)\n\t\tcase \"plain\":\n\t\t\tauth = smtp.PlainAuth(\"\", s.Username, s.Password, s.Host)\n\t\tcase \"login\":\n\t\t\tauth = &smtppool.LoginAuth{Username: s.Username, Password: s.Password}\n\t\tcase \"\", \"none\":\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown SMTP auth type '%s'\", s.AuthProtocol)\n\t\t}\n\t\ts.Opt.Auth = auth\n\n\t\t// TLS config.\n\t\ts.Opt.SSL = smtppool.SSLNone\n\t\tif s.TLSType != \"none\" {\n\t\t\ts.TLSConfig = &tls.Config{}\n\t\t\tif s.TLSSkipVerify {\n\t\t\t\ts.TLSConfig.InsecureSkipVerify = s.TLSSkipVerify\n\t\t\t} else {\n\t\t\t\ts.TLSConfig.ServerName = s.Host\n\t\t\t}\n\n\t\t\t// SSL/TLS, not STARTTLS.\n\t\t\tswitch s.TLSType {\n\t\t\tcase \"TLS\":\n\t\t\t\ts.Opt.SSL = smtppool.SSLTLS\n\t\t\tcase \"STARTTLS\":","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/knadh/listmonk/blob/670c01717d48647093335cc23a6be6f4b79c3b6b/internal/messenger/email/email.go#L65-L101","documentation":"New() builds an SMTP messenger and maps s.AuthProtocol to an smtp/smtppool auth mechanism. Only \"plain\", \"login\", and \"\"/\"none\" are recognized; any other value falls into the default branch and returns this error instead of a messenger.","triggerScenarios":"Calling New (directly or via initSMTPMessengers or TestSMTPSettings) with SMTPSettings.AuthProtocol set to any string other than \"plain\", \"login\", \"\", or \"none\" — e.g. \"cram-md5\", \"oauth2\", \"PLAIN\" (case-sensitive).","commonSituations":"Typo in the SMTP auth setting in config/UI; uppercase value like \"PLAIN\" since the switch is case-sensitive; copying auth settings from another mailer that uses different names (e.g. \"cram-md5\"); newer auth schemes not supported by this codebase.","solutions":["Set AuthProtocol to one of: \"plain\", \"login\", or \"\"/\"none\" (empty means no auth)","Check for case mismatches — values are matched exactly, lowercase","If you need CRAM-MD5/OAuth2, add a case to the switch in New() mapping to the appropriate smtp auth type"],"exampleFix":"// before\ns.AuthProtocol = \"PLAIN\"\n// after\ns.AuthProtocol = \"plain\"","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"plain\": true, \"login\": true, \"\": true, \"none\": true}\nif !allowed[settings.AuthProtocol] {\n    return fmt.Errorf(\"AuthProtocol must be plain|login|none, got %q\", settings.AuthProtocol)\n}","typeGuard":null,"tryCatchPattern":"if _, err := email.New(settings); err != nil {\n    if strings.Contains(err.Error(), \"unknown SMTP auth type\") {\n        // fall back to defaults or surface a config error to the user\n    }\n}","preventionTips":["Always set AuthProtocol from a fixed dropdown, never free text","Lowercase/trim the value before passing to New","Add a startup config validation step that checks SMTP settings before first send"],"tags":["smtp","email","config"],"backgroundTag":"invalid-config-value","analyzedSha":"670c01717d48647093335cc23a6be6f4b79c3b6b","analyzedAt":"2026-09-01T03:39:35.452Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}