# PostaHostingExtensions Methods

- Package: [CommunityToolkit.Aspire.Hosting.Posta](/reference/api/csharp/communitytoolkit.aspire.hosting.posta.md)
- Type: [PostaHostingExtensions](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postahostingextensions.md)
- Kind: `Methods`
- Members: `19`

Provides extension methods for adding Posta to an `Hosting.IDistributedApplicationBuilder`.

<a id="addposta"></a>
<a id="addposta-idistributedapplicationbuilder-string-iresourcebuilder-postgresdatabaseresource-iresourcebuilder-redisresource-iresourcebuilder-parameterresource-iresourcebuilder-parameterresource-string-int"></a>

## AddPosta(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresDatabaseResource>, IResourceBuilder<RedisResource>, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, string, int?)

- Name: `AddPosta(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresDatabaseResource>, IResourceBuilder<RedisResource>, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, string, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L38-L44)

Adds a Posta container resource to the `Hosting.IDistributedApplicationBuilder` and configures PostgreSQL and Redis references.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> AddPosta(
        this IDistributedApplicationBuilder builder,
        string name,
        IResourceBuilder<PostgresDatabaseResource> database,
        IResourceBuilder<RedisResource> redis,
        IResourceBuilder<ParameterResource>? jwtSecret = null,
        IResourceBuilder<ParameterResource>? adminPassword = null,
        string adminEmail = "admin@example.com",
        int? port = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The `Hosting.IDistributedApplicationBuilder` to which the Posta resource will be added.
- `name` (`string`)
  The name of the Posta container resource.
- `database` (`IResourceBuilder<PostgresDatabaseResource>`)
  The PostgreSQL database resource used by Posta.
- `redis` (`IResourceBuilder<RedisResource>`)
  The Redis resource used by Posta.
- `jwtSecret` (`IResourceBuilder<ParameterResource>`) `optional`
  Optional parameter used as the Posta JWT signing secret.
- `adminPassword` (`IResourceBuilder<ParameterResource>`) `optional`
  Optional parameter used as the initial Posta admin password.
- `adminEmail` (`string`) `optional`
  The initial Posta admin account email.
- `port` (`int?`) `optional`
  Optional host port for the Posta HTTP API and dashboard.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### ATS export

- Capability ID: `CommunityToolkit.Aspire.Hosting.Posta/addPostaWithReferences`
- Generated method name override: `addPostaWithReferences`

<a id="addposta-idistributedapplicationbuilder-string-iresourcebuilder-postgresdatabaseresource-iresourcebuilder-redisresource-postaoptions-iresourcebuilder-parameterresource-iresourcebuilder-parameterresource-string-int"></a>

## AddPosta(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresDatabaseResource>, IResourceBuilder<RedisResource>, PostaOptions, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, string, int?)

- Name: `AddPosta(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresDatabaseResource>, IResourceBuilder<RedisResource>, PostaOptions, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, string, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L72-L79)

Adds a Posta container resource to the `Hosting.IDistributedApplicationBuilder` with PostgreSQL, Redis, and additional Posta environment configuration.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> AddPosta(
        this IDistributedApplicationBuilder builder,
        string name,
        IResourceBuilder<PostgresDatabaseResource> database,
        IResourceBuilder<RedisResource> redis,
        PostaOptions options,
        IResourceBuilder<ParameterResource>? jwtSecret = null,
        IResourceBuilder<ParameterResource>? adminPassword = null,
        string adminEmail = "admin@example.com",
        int? port = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The `Hosting.IDistributedApplicationBuilder` to which the Posta resource will be added.
- `name` (`string`)
  The name of the Posta container resource.
- `database` (`IResourceBuilder<PostgresDatabaseResource>`)
  The PostgreSQL database resource used by Posta.
- `redis` (`IResourceBuilder<RedisResource>`)
  The Redis resource used by Posta.
- `options` ([PostaOptions](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postaoptions.md))
  The Posta environment configuration.
- `jwtSecret` (`IResourceBuilder<ParameterResource>`) `optional`
  Optional parameter used as the Posta JWT signing secret.
- `adminPassword` (`IResourceBuilder<ParameterResource>`) `optional`
  Optional parameter used as the initial Posta admin password.
- `adminEmail` (`string`) `optional`
  The initial Posta admin account email.
- `port` (`int?`) `optional`
  Optional host port for the Posta HTTP API and dashboard.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: PostaOptions contains parameter builders for secret values and is not supported in polyglot AppHosts.

<a id="addposta-idistributedapplicationbuilder-string-iresourcebuilder-postgresdatabaseresource-iresourcebuilder-redisresource-action-postaoptions-iresourcebuilder-parameterresource-iresourcebuilder-parameterresource-string-int"></a>

## AddPosta(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresDatabaseResource>, IResourceBuilder<RedisResource>, Action<PostaOptions>, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, string, int?)

- Name: `AddPosta(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresDatabaseResource>, IResourceBuilder<RedisResource>, Action<PostaOptions>, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, string, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L107-L115)

Adds a Posta container resource to the `Hosting.IDistributedApplicationBuilder` with PostgreSQL, Redis, and additional Posta environment configuration.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> AddPosta(
        this IDistributedApplicationBuilder builder,
        string name,
        IResourceBuilder<PostgresDatabaseResource> database,
        IResourceBuilder<RedisResource> redis,
        Action<PostaOptions> configureOptions,
        IResourceBuilder<ParameterResource>? jwtSecret = null,
        IResourceBuilder<ParameterResource>? adminPassword = null,
        string adminEmail = "admin@example.com",
        int? port = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The `Hosting.IDistributedApplicationBuilder` to which the Posta resource will be added.
- `name` (`string`)
  The name of the Posta container resource.
- `database` (`IResourceBuilder<PostgresDatabaseResource>`)
  The PostgreSQL database resource used by Posta.
- `redis` (`IResourceBuilder<RedisResource>`)
  The Redis resource used by Posta.
- `configureOptions` (`Action<PostaOptions>`)
  A delegate that configures Posta environment variables.
- `jwtSecret` (`IResourceBuilder<ParameterResource>`) `optional`
  Optional parameter used as the Posta JWT signing secret.
- `adminPassword` (`IResourceBuilder<ParameterResource>`) `optional`
  Optional parameter used as the initial Posta admin password.
- `adminEmail` (`string`) `optional`
  The initial Posta admin account email.
- `port` (`int?`) `optional`
  Optional host port for the Posta HTTP API and dashboard.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: Action<PostaOptions> is not supported in polyglot AppHosts. Use the options object overload instead.

<a id="withdatabindmount"></a>
<a id="withdatabindmount-iresourcebuilder-postaresource-string-bool"></a>

## WithDataBindMount(IResourceBuilder<PostaResource>, string, bool)

- Name: `WithDataBindMount(IResourceBuilder<PostaResource>, string, bool)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L149-L152)

Adds a bind mount for Posta's filesystem-backed attachment data.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithDataBindMount(
        this IResourceBuilder<PostaResource> builder,
        string source,
        bool isReadOnly = false)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `source` (`string`)
  The source directory on the host to mount into the container.
- `isReadOnly` (`bool`) `optional`
  Indicates whether the bind mount should be read-only.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withdatavolume"></a>
<a id="withdatavolume-iresourcebuilder-postaresource-string-bool"></a>

## WithDataVolume(IResourceBuilder<PostaResource>, string?, bool)

- Name: `WithDataVolume(IResourceBuilder<PostaResource>, string?, bool)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L131-L133)

Adds a named volume for Posta's filesystem-backed attachment data.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithDataVolume(
        this IResourceBuilder<PostaResource> builder,
        string? name = null,
        bool isReadOnly = false)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `name` (`string?`) `optional`
  The name of the volume. Defaults to an auto-generated name based on the application and resource names.
- `isReadOnly` (`bool`) `optional`
  Indicates whether the volume should be read-only.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withemailverification"></a>
<a id="withemailverification-iresourcebuilder-postaresource-postaemailverificationoptions"></a>

## WithEmailVerification(IResourceBuilder<PostaResource>, PostaEmailVerificationOptions)

- Name: `WithEmailVerification(IResourceBuilder<PostaResource>, PostaEmailVerificationOptions)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L448-L451)

Configures email verification behavior for Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithEmailVerification(
        this IResourceBuilder<PostaResource> builder,
        PostaEmailVerificationOptions options)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `options` ([PostaEmailVerificationOptions](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postaemailverificationoptions.md))
  The parameter-based email verification configuration.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: PostaEmailVerificationOptions contains parameter builders and is intended for C# AppHosts.

<a id="withemailverification-iresourcebuilder-postaresource-action-postaemailverificationoptions"></a>

## WithEmailVerification(IResourceBuilder<PostaResource>, Action<PostaEmailVerificationOptions>)

- Name: `WithEmailVerification(IResourceBuilder<PostaResource>, Action<PostaEmailVerificationOptions>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L465-L471)

Configures email verification behavior for Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithEmailVerification(
        this IResourceBuilder<PostaResource> builder,
        Action<PostaEmailVerificationOptions> configureOptions)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `configureOptions` (`Action<PostaEmailVerificationOptions>`)
  A delegate that configures the parameter-based email verification options.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: Action<PostaEmailVerificationOptions> is not supported in polyglot AppHosts. Use the options object overload instead.

<a id="withgoogleoauth"></a>
<a id="withgoogleoauth-iresourcebuilder-postaresource-postagoogleoauthoptions"></a>

## WithGoogleOAuth(IResourceBuilder<PostaResource>, PostaGoogleOAuthOptions)

- Name: `WithGoogleOAuth(IResourceBuilder<PostaResource>, PostaGoogleOAuthOptions)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L411-L414)

Configures Google OAuth login for Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithGoogleOAuth(
        this IResourceBuilder<PostaResource> builder,
        PostaGoogleOAuthOptions options)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `options` ([PostaGoogleOAuthOptions](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postagoogleoauthoptions.md))
  The parameter-based Google OAuth configuration.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: PostaGoogleOAuthOptions contains parameter builders and is intended for C# AppHosts.

<a id="withgoogleoauth-iresourcebuilder-postaresource-action-postagoogleoauthoptions"></a>

## WithGoogleOAuth(IResourceBuilder<PostaResource>, Action<PostaGoogleOAuthOptions>)

- Name: `WithGoogleOAuth(IResourceBuilder<PostaResource>, Action<PostaGoogleOAuthOptions>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L428-L434)

Configures Google OAuth login for Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithGoogleOAuth(
        this IResourceBuilder<PostaResource> builder,
        Action<PostaGoogleOAuthOptions> configureOptions)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `configureOptions` (`Action<PostaGoogleOAuthOptions>`)
  A delegate that configures the parameter-based Google OAuth options.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: Action<PostaGoogleOAuthOptions> is not supported in polyglot AppHosts. Use the options object overload instead.

<a id="withinboundsmtp"></a>
<a id="withinboundsmtp-iresourcebuilder-postaresource-postainboundsmtpoptions-int-int"></a>

## WithInboundSmtp(IResourceBuilder<PostaResource>, PostaInboundSmtpOptions, int?, int)

- Name: `WithInboundSmtp(IResourceBuilder<PostaResource>, PostaInboundSmtpOptions, int?, int)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L271-L283)

Configures the built-in inbound SMTP receiver used by Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithInboundSmtp(
        this IResourceBuilder<PostaResource> builder,
        PostaInboundSmtpOptions options,
        int? port = null,
        int targetPort = 2525)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `options` ([PostaInboundSmtpOptions](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postainboundsmtpoptions.md))
  The parameter-based inbound SMTP configuration.
- `port` (`int?`) `optional`
  Optional host port for the inbound SMTP endpoint.
- `targetPort` (`int`) `optional`
  The port on which Posta listens for inbound SMTP inside the container. This must match [PostaInboundSmtpOptions.Port](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postainboundsmtpoptions/properties.md#port) when that option is supplied.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: PostaInboundSmtpOptions contains parameter builders and is intended for C# AppHosts.

<a id="withinboundsmtp-iresourcebuilder-postaresource-action-postainboundsmtpoptions-int-int"></a>

## WithInboundSmtp(IResourceBuilder<PostaResource>, Action<PostaInboundSmtpOptions>, int?, int)

- Name: `WithInboundSmtp(IResourceBuilder<PostaResource>, Action<PostaInboundSmtpOptions>, int?, int)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L301-L307)

Configures the built-in inbound SMTP receiver used by Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithInboundSmtp(
        this IResourceBuilder<PostaResource> builder,
        Action<PostaInboundSmtpOptions> configureOptions,
        int? port = null,
        int targetPort = 2525)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `configureOptions` (`Action<PostaInboundSmtpOptions>`)
  A delegate that configures the parameter-based inbound SMTP options.
- `port` (`int?`) `optional`
  Optional host port for the inbound SMTP endpoint.
- `targetPort` (`int`) `optional`
  The port on which Posta listens for inbound SMTP inside the container. This must match [PostaInboundSmtpOptions.Port](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postainboundsmtpoptions/properties.md#port) when that option is supplied.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: Action<PostaInboundSmtpOptions> is not supported in polyglot AppHosts. Use the options object overload instead.

<a id="withreference"></a>
<a id="withreference-iresourcebuilder-postaresource-iresourcebuilder-postgresdatabaseresource"></a>

## WithReference(IResourceBuilder<PostaResource>, IResourceBuilder<PostgresDatabaseResource>)

- Name: `WithReference(IResourceBuilder<PostaResource>, IResourceBuilder<PostgresDatabaseResource>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L166-L181)

Configures the PostgreSQL database used by Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithReference(
        this IResourceBuilder<PostaResource> builder,
        IResourceBuilder<PostgresDatabaseResource> database)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `database` (`IResourceBuilder<PostgresDatabaseResource>`)
  The PostgreSQL database resource used by Posta.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### ATS export

- Capability ID: `CommunityToolkit.Aspire.Hosting.Posta/withPostgresReference`
- Generated method name override: `withPostgresReference`

<a id="withreference-iresourcebuilder-postaresource-iresourcebuilder-redisresource-iresourcebuilder-parameterresource"></a>

## WithReference(IResourceBuilder<PostaResource>, IResourceBuilder<RedisResource>, IResourceBuilder<ParameterResource>)

- Name: `WithReference(IResourceBuilder<PostaResource>, IResourceBuilder<RedisResource>, IResourceBuilder<ParameterResource>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L197-L216)

Configures the Redis server used by Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithReference(
        this IResourceBuilder<PostaResource> builder,
        IResourceBuilder<RedisResource> redis,
        IResourceBuilder<ParameterResource>? redisPassword = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `redis` (`IResourceBuilder<RedisResource>`)
  The Redis resource used by Posta.
- `redisPassword` (`IResourceBuilder<ParameterResource>`) `optional`
  Optional Redis password parameter that overrides the referenced Redis resource password.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### ATS export

- Capability ID: `CommunityToolkit.Aspire.Hosting.Posta/withRedisReference`
- Generated method name override: `withRedisReference`

<a id="withs3blobstorage"></a>
<a id="withs3blobstorage-iresourcebuilder-postaresource-postas3blobstorageoptions"></a>

## WithS3BlobStorage(IResourceBuilder<PostaResource>, PostaS3BlobStorageOptions)

- Name: `WithS3BlobStorage(IResourceBuilder<PostaResource>, PostaS3BlobStorageOptions)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L374-L377)

Configures S3-compatible attachment storage for Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithS3BlobStorage(
        this IResourceBuilder<PostaResource> builder,
        PostaS3BlobStorageOptions options)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `options` ([PostaS3BlobStorageOptions](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postas3blobstorageoptions.md))
  The parameter-based S3 blob storage configuration.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: PostaS3BlobStorageOptions contains parameter builders and is intended for C# AppHosts.

<a id="withs3blobstorage-iresourcebuilder-postaresource-action-postas3blobstorageoptions"></a>

## WithS3BlobStorage(IResourceBuilder<PostaResource>, Action<PostaS3BlobStorageOptions>)

- Name: `WithS3BlobStorage(IResourceBuilder<PostaResource>, Action<PostaS3BlobStorageOptions>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L391-L397)

Configures S3-compatible attachment storage for Posta.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithS3BlobStorage(
        this IResourceBuilder<PostaResource> builder,
        Action<PostaS3BlobStorageOptions> configureOptions)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `configureOptions` (`Action<PostaS3BlobStorageOptions>`)
  A delegate that configures the parameter-based S3 blob storage options.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: Action<PostaS3BlobStorageOptions> is not supported in polyglot AppHosts. Use the options object overload instead.

<a id="withsmtprelay"></a>
<a id="withsmtprelay-iresourcebuilder-postaresource-postasmtprelayoptions-int-int"></a>

## WithSmtpRelay(IResourceBuilder<PostaResource>, PostaSmtpRelayOptions, int?, int)

- Name: `WithSmtpRelay(IResourceBuilder<PostaResource>, PostaSmtpRelayOptions, int?, int)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L325-L337)

Configures and exposes Posta's authenticated SMTP relay.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithSmtpRelay(
        this IResourceBuilder<PostaResource> builder,
        PostaSmtpRelayOptions options,
        int? port = null,
        int targetPort = 2526)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `options` ([PostaSmtpRelayOptions](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postasmtprelayoptions.md))
  The parameter-based SMTP relay configuration.
- `port` (`int?`) `optional`
  Optional host port.
- `targetPort` (`int`) `optional`
  The relay port inside the container.

## Returns

`IResourceBuilder<PostaResource>` -- The Posta resource builder.

## ATS metadata

### Ignored by ATS

- Reason: PostaSmtpRelayOptions contains parameter builders and is intended for C# AppHosts.

<a id="withsmtprelay-iresourcebuilder-postaresource-action-postasmtprelayoptions-int-int"></a>

## WithSmtpRelay(IResourceBuilder<PostaResource>, Action<PostaSmtpRelayOptions>, int?, int)

- Name: `WithSmtpRelay(IResourceBuilder<PostaResource>, Action<PostaSmtpRelayOptions>, int?, int)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L355-L360)

Configures and exposes Posta's authenticated SMTP relay.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithSmtpRelay(
        this IResourceBuilder<PostaResource> builder,
        Action<PostaSmtpRelayOptions> configureOptions,
        int? port = null,
        int targetPort = 2526)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `configureOptions` (`Action<PostaSmtpRelayOptions>`)
  A delegate that configures the SMTP relay.
- `port` (`int?`) `optional`
  Optional host port.
- `targetPort` (`int`) `optional`
  The relay port inside the container.

## Returns

`IResourceBuilder<PostaResource>` -- The Posta resource builder.

## ATS metadata

### Ignored by ATS

- Reason: Action<PostaSmtpRelayOptions> is not supported in polyglot AppHosts.

<a id="withsystemsmtp"></a>
<a id="withsystemsmtp-iresourcebuilder-postaresource-postasystemsmtpoptions"></a>

## WithSystemSmtp(IResourceBuilder<PostaResource>, PostaSystemSmtpOptions)

- Name: `WithSystemSmtp(IResourceBuilder<PostaResource>, PostaSystemSmtpOptions)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L230-L233)

Configures the system SMTP server used by Posta for platform notifications.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithSystemSmtp(
        this IResourceBuilder<PostaResource> builder,
        PostaSystemSmtpOptions options)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `options` ([PostaSystemSmtpOptions](/reference/api/csharp/communitytoolkit.aspire.hosting.posta/postasystemsmtpoptions.md))
  The parameter-based system SMTP configuration.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: PostaSystemSmtpOptions contains parameter builders and is intended for C# AppHosts.

<a id="withsystemsmtp-iresourcebuilder-postaresource-action-postasystemsmtpoptions"></a>

## WithSystemSmtp(IResourceBuilder<PostaResource>, Action<PostaSystemSmtpOptions>)

- Name: `WithSystemSmtp(IResourceBuilder<PostaResource>, Action<PostaSystemSmtpOptions>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<PostaResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1/src/CommunityToolkit.Aspire.Hosting.Posta/PostaHostingExtensions.cs#L247-L253)

Configures the system SMTP server used by Posta for platform notifications.

```csharp
public static class PostaHostingExtensions
{
    public static IResourceBuilder<PostaResource> WithSystemSmtp(
        this IResourceBuilder<PostaResource> builder,
        Action<PostaSystemSmtpOptions> configureOptions)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<PostaResource>`)
  The Posta resource builder.
- `configureOptions` (`Action<PostaSystemSmtpOptions>`)
  A delegate that configures the parameter-based system SMTP options.

## Returns

`IResourceBuilder<PostaResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1` for further resource configuration.

## ATS metadata

### Ignored by ATS

- Reason: Action<PostaSystemSmtpOptions> is not supported in polyglot AppHosts. Use the options object overload instead.
