{"record":{"id":"a267dade580d13cb","repo":"OrchardCMS/OrchardCore","slug":"the-smtp-pickup-directory-location-is-invalid","errorCode":null,"errorMessage":"The SMTP pickup directory location is invalid.","messagePattern":"The SMTP pickup directory location is invalid\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.Email.Smtp/Services/SmtpPickupDirectoryResolver.cs","lineNumber":62,"sourceCode":"        ArgumentNullException.ThrowIfNull(shellSettings);\n\n        var pickupDirectoryLocationBase = string.IsNullOrWhiteSpace(configuredBasePath)\n            ? DefaultPickupDirectoryLocationBaseTemplate\n            : configuredBasePath;\n\n        var formattedPickupDirectoryLocationBase = ParseAndFormat(pickupDirectoryLocationBase, fluidParser, shellOptions, shellSettings);\n        formattedPickupDirectoryLocationBase = NormalizeDirectorySeparators(formattedPickupDirectoryLocationBase);\n\n        return Path.GetFullPath(formattedPickupDirectoryLocationBase);\n    }\n\n    public static string ResolvePickupDirectoryLocation(string pickupDirectoryLocationBase, string pickupDirectoryLocation)\n    {\n        ArgumentException.ThrowIfNullOrWhiteSpace(pickupDirectoryLocationBase);\n\n        if (!IsValidPickupDirectoryLocation(pickupDirectoryLocation))\n        {\n            throw new InvalidOperationException(\"The SMTP pickup directory location is invalid.\");\n        }\n\n        var normalizedPickupDirectoryLocation = NormalizePickupDirectoryLocation(pickupDirectoryLocation);\n\n        var fullPickupDirectoryLocation = string.IsNullOrWhiteSpace(normalizedPickupDirectoryLocation)\n            ? pickupDirectoryLocationBase\n            : Path.GetFullPath(Path.Combine(pickupDirectoryLocationBase, normalizedPickupDirectoryLocation));\n\n        if (!IsWithinBasePath(pickupDirectoryLocationBase, fullPickupDirectoryLocation))\n        {\n            throw new InvalidOperationException($\"The SMTP pickup directory location '{pickupDirectoryLocation}' resolves outside the configured pickup directory base '{pickupDirectoryLocationBase}'.\");\n        }\n\n        return fullPickupDirectoryLocation;\n    }\n\n    public static bool IsValidPickupDirectoryLocation(string pickupDirectoryLocation)\n    {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Email.Smtp/Services/SmtpPickupDirectoryResolver.cs#L44-L80","documentation":"SmtpPickupDirectoryResolver.ResolvePickupDirectoryLocation validates the configured pickup directory location string and throws InvalidOperationException when it fails IsValidPickupDirectoryLocation (null, whitespace, or otherwise invalid path characters/shape). The base location is separately guaranteed non-blank via ArgumentException.","triggerScenarios":"SMTP settings have PickupDirectoryLocation set to an empty, whitespace-only, or invalid value; ConfigurePickupDirectory calls the resolver with that value and the validation check fails.","commonSituations":"Admin left the pickup directory field blank while selecting the pickup-directory delivery method; a config/recipe migration wiped the value; invalid characters pasted into the settings field.","solutions":["Set a valid absolute PickupDirectoryLocation in the SMTP settings (Features > Email SMTP settings).","If the location equals the base, clear the per-location value so the base is used.","Check the appsettings/recipe supplying SmtpSettings for an empty or malformed path.","Use only valid path characters (no illegal filename characters, no empty string) for the value."],"exampleFix":"// before (appsettings or SMTP settings)\n\"PickupDirectoryLocation\": \"\"\n// after\n\"PickupDirectoryLocation\": \"C:\\\\inetpub\\\\mailroot\\\\Pickup\"","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(pickupDirectoryLocation))\n    throw new InvalidOperationException(\"Configure a valid SMTP pickup directory location before saving.\");","typeGuard":null,"tryCatchPattern":"try { var dir = SmtpPickupDirectoryResolver.ResolvePickupDirectoryLocation(basePath, location); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"pickup directory location is invalid\")) { /* surface settings validation error to admin */ }","preventionTips":["Require a non-empty pickup directory value when pickup-directory delivery is selected.","Use absolute paths with valid path characters only.","Validate SMTP settings in the driver before persisting them."],"tags":["email","smtp","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}