{"record":{"id":"ac8e92e1286a0715","repo":"goreleaser/goreleaser","slug":"smtp-missing-smtp-host-or-smtp-host","errorCode":null,"errorMessage":"SMTP: missing smtp.host or $SMTP_HOST","messagePattern":"SMTP: missing smtp\\.host or \\$SMTP_HOST","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/smtp/smtp.go","lineNumber":100,"sourceCode":"\n\t// This is only needed when SSL/TLS certificate is not valid on server.\n\t// In production this should be set to false.\n\td.TLSConfig = &tls.Config{InsecureSkipVerify: ctx.Config.Announce.SMTP.InsecureSkipVerify}\n\n\t// Now send E-Mail\n\tif err := d.DialAndSend(m); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"The mail has been send from %s to %s\\n\", ctx.Config.Announce.SMTP.From, receivers)\n\n\treturn nil\n}\n\nvar (\n\terrNoPort     = errors.New(\"SMTP: missing smtp.port or $SMTP_PORT\")\n\terrNoUsername = errors.New(\"SMTP: missing smtp.username or $SMTP_USERNAME\")\n\terrNoHost     = errors.New(\"SMTP: missing smtp.host or $SMTP_HOST\")\n)\n\nfunc getConfig(smtp config.SMTP) (Config, error) {\n\tcfg := Config{\n\t\tHost:     smtp.Host,\n\t\tPort:     smtp.Port,\n\t\tUsername: smtp.Username,\n\t}\n\tif err := env.Parse(&cfg); err != nil {\n\t\treturn cfg, fmt.Errorf(\"SMTP: %w\", err)\n\t}\n\tif cfg.Username == \"\" {\n\t\treturn cfg, errNoUsername\n\t}\n\tif cfg.Host == \"\" {\n\t\treturn cfg, errNoHost\n\t}\n\tif cfg.Port == 0 {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/smtp/smtp.go#L82-L118","documentation":"Sentinel error errNoHost, returned by the SMTP config loader when the resolved `host` is empty — i.e. neither `smtp.host` in .goreleaser.yaml nor the $SMTP_HOST environment variable was set. Without a relay host the mail cannot be sent, so config validation fails fast.","triggerScenarios":"`announce.smtp` block present in .goreleaser.yaml but `host` field empty and $SMTP_HOST unset when announcing.","commonSituations":"Users add the announce pipe with only from/to/receivers configured; migrating between environments where $SMTP_HOST was defined locally but not in CI; YAML indentation mistakes putting host at the wrong level.","solutions":["Set `announce.smtp.host` in .goreleaser.yaml (e.g. smtp.example.com).","Export $SMTP_HOST in your environment/CI.","Verify YAML indentation so `host` is nested directly under `announce.smtp`."],"exampleFix":"# before\nannounce:\n  smtp:\n    port: 587\n    from: ci@example.com\n# after\nannounce:\n  smtp:\n    host: smtp.example.com\n    port: 587\n    from: ci@example.com","handlingStrategy":"validation","validationCode":"if os.Getenv(\"SMTP_HOST\") == \"\" {\n    fmt.Println(\"set announce.smtp.host or export SMTP_HOST before running goreleaser\")\n}","typeGuard":null,"tryCatchPattern":"if err := Pipe{}.Run(ctx); err != nil {\n    if errors.Is(err, errNoHost) {\n        log.Fatal(\"SMTP announce: missing smtp.host / $SMTP_HOST\")\n    }\n    log.Fatal(err)\n}","preventionTips":["Define host, port, username, from/receivers as a complete set in one config block.","Keep SMTP settings in a shared .env sourced by both local and CI runs.","Verify YAML nesting: host must sit directly under announce.smtp."],"tags":["goreleaser","smtp","config","announce"],"backgroundTag":"missing-env-var","analyzedSha":"f5edd7395693c0c6b501dc722d445d2e86af854d","analyzedAt":"2026-09-05T09:57:18.807Z","contentChangedAt":"2026-09-05T09:57:18.807Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}