边缘传输服务器上的地址重写过程

您可以在边缘传输服务器上创建适用于单个收件人、特定域或子域或多个子域的地址重写条目。 地址重写可以是仅出站,也可以是入站和出站(双向)。 当您创建地址重写条目时,请注意以下几点:

  • 验证生成的电子邮件地址是否在您的组织中具有唯一性。

  • 电子邮件地址值中仅支持文本字符串。

  • 只有内部地址(要更改的地址)才支持通配符 (*)。 验证使用通配符的语法是否是 *.contoso.com。 不允许使用值 *contoso.comsales.*.com

  • 使用通配符时,需要将地址重写配置为仅出站 (需要将 OutboundOnly 参数设置为值 $true) ,而仅出站地址重写要求将重写的电子邮件地址配置为受影响的收件人的代理地址。

  • 默认情况下,对于单个收件人或特定域或子域,地址重写是双向的, (OutboundOnly 参数的默认值为 $false) 。

有关地址重写的详细信息,请参阅边缘传输服务器上的地址重写

开始前,有必要了解什么?

  • 完成每个过程的估计时间:10 分钟。

  • 您必须先获得权限,然后才能执行此过程或多个过程。 若要查看所需的权限,请参阅 邮件流权限主题中的"边缘传输服务器"部分。

  • 只能使用 PowerShell 执行此过程。 若要了解如何在本地 Exchange 组织中打开 Exchange 命令行管理程序,请参阅 Open the Exchange Management Shell

  • 请谨慎配置地址重写。 在您运行命令时,您所做的所有更改都会立即应用。 请考虑使用 WhatIf 参数运行 命令。 有关 WhatIf 参数的详细信息,请参阅 WhatIf 和 Confirm

  • 若要了解本主题中的过程可能适用的键盘快捷键,请参阅 Exchange 管理中心内的键盘快捷键

提示

是否有任何疑问? 请在 Exchange 论坛中寻求帮助。 请访问以下论坛:Exchange ServerExchange OnlineExchange Online Protection

使用 Exchange 命令行管理程序 启用或禁用地址重写

若要完全启用或禁用地址重写,请启用或禁用地址重写代理。 默认情况下,边缘传输服务器上的地址重写代理处于启用状态。

若要禁用地址重写,请运行以下命令:

Disable-TransportAgent "Address Rewriting Inbound Agent"; Disable-TransportAgent "Address Rewriting Outbound Agent"

若要启用地址重写,请运行以下命令:

Enable-TransportAgent "Address Rewriting Inbound Agent"; Enable-TransportAgent "Address Rewriting Outbound Agent"

如何知道操作成功?

若要验证您是否已成功启用或禁用地址重写,请运行以下命令来验证 Enabled 属性值:

Get-TransportAgent "Address Rewriting *"

使用 Exchange 命令行管理程序 查看地址重写条目

若要查看所有地址重写条目的摘要列表,请运行以下命令。

Get-AddressRewriteEntry

若要查看地址重写条目的详细信息,请使用以下语法。

Get-AddressRewriteEntry <AddressRewriteEntryIdentity> | Format-List

以下示例显示"Contoso.com 重写为 Northwindtraders.com"地址重写条目的详细信息:

Get-AddressRewriteEntry "Rewrite Contoso.com to Northwindtraders.com" | Format-List

有关详细信息,请参阅 Get-AddressRewriteEntry

使用 Exchange 命令行管理程序 创建地址重写条目

重写单个收件人的电子邮件地址

若要重写单个收件人的电子邮件地址,请使用以下语法:

New-AddressRewriteEntry -Name "<Descriptive Name>" -InternalAddress <internal email address> -ExternalAddress <external email address> [-OutboundOnly <$true | $false>]

本示例重写进入和离开 Exchange 组织 joe@contoso.com的所有邮件的电子邮件地址。 出站消息被重写,因此它们看起来来自 support@nortwindtraders.com。 发送到 support@northwindtraders.com 的入站邮件将重写为 joe@contoso.com 以传递给收件人, (OutboundOnly 参数 $false 默认为) 。

New-AddressRewriteEntry -Name "joe@contoso.com to support@northwindtraders.com" -InternalAddress joe@contoso.com -ExternalAddress support@northwindtraders.com

重写单个域或子域中的电子邮件地址

若要重写单个域或子域中的电子邮件地址,请使用以下语法:

New-AddressRewriteEntry -Name "<Descriptive Name>" -InternalAddress <domain or subdomain> -ExternalAddress <domain> [-OutboundOnly <$true | $false>]

此示例重写 contoso.com 域中进入和离开 Exchange 组织的所有邮件的电子邮件地址。 重写的出站邮件看起来好像来自 fabrikam.com 域。 发送到 fabrikam.com 电子邮件地址的入站邮件将重写为 contoso.com,以便发送给收件人, (OutboundOnly 参数 $false 默认) 。

New-AddressRewriteEntry -Name "Contoso to Fabrikam" -InternalAddress contoso.com -ExternalAddress fabrikam.com

此示例重写 sales.contoso.com 子域中离开 Exchange 组织的所有邮件的电子邮件地址。 重写的出站邮件看起来好像来自 contoso.com 域。 发送到 contoso.com 电子邮件地址的入站邮件不会得到重写。

New-AddressRewriteEntry -Name "sales.contoso.com to contoso.com" -InternalAddress sales.contoso.com -ExternalAddress contoso.com -OutboundOnly $true

重写多个子域中的电子邮件地址

若要重写某个域及其所有子域中的电子邮件地址,请使用以下语法。

New-AddressRewriteEntry -Name "<Descriptive Name>" -InternalAddress *.<domain> -ExternalAddress <domain> -OutboundOnly $true [-ExceptionList <domain1,domain2...>]

此示例重写 contoso.com 域及其所有子域中离开 Exchange 组织的所有邮件的电子邮件地址。 重写的出站邮件看起来好像来自 contoso.com 域。 无法重写发送到 contoso.com 收件人的入站邮件,因为在 InternalAddress 参数中使用通配符。

New-AddressRewriteEntry -Name "Rewrite all contoso.com subdomains" -InternalAddress *.contoso.com -ExternalAddress contoso.com -OutboundOnly $true

此示例与上一示例类似,不同之处在于现在由 legal.contoso.com 和 corp.contoso.com 子域中的邮件不再进行重写:

New-AddressRewriteEntry -Name "Rewrite all contoso.com subdomains except legal.contoso.com and corp.contoso.com" -InternalAddress *.contoso.com -ExternalAddress contoso.com -OutboundOnly $true -ExceptionList legal.contoso.com,corp.contoso.com

有关详细信息,请参阅 New-AddressRewriteEntry

如何知道操作成功?

若要验证是否已成功创建地址重写条目,请执行以下操作:

  1. AddressRewriteEntryIdentity> 替换为<地址重写条目的名称,并运行以下命令来验证属性值:

    Get-AddressRewriteEntry <AddressRewriteEntryIdentity> | Format-List
    
  2. 从受到地址重写条目影响的邮箱向外部邮箱发送一封测试邮件。 验证测试邮件是否看起来好像来自重写的电子邮件地址。

  3. 从外部邮箱回复测试邮件。 验证原始邮箱是否收到回复。

使用 Exchange 命令行管理程序 修改地址重写条目

修改现有地址重写条目和新建地址重写条目时可用的配置选项完全相同。

修改单个收件人的地址重写条目

若要修改可重写单个收件人的电子邮件地址的地址重写条目,请使用以下语法:

Set-AddressRewriteEntry <AddressRewriteEntryIdentity> [-Name "<Descriptive Name>"] [-InternalAddress <internal email address>] [-ExternalAddress <external email address>] [-OutboundOnly <$true | $false>]

此示例将名为 “joe@contoso.com 的地址重写项的以下属性修改为 support@nortwindtraders.com”:

  • 将外部地址更改为 support@northwindtraders.net。

  • 将地址重写项的名称更改为 “joe@contoso.com 到 support@northwindtraders.net” 。

  • OutboundOnly 的值更改为 $true。 请注意,此更改要求将 support@northwindtraders.net 配置为 Joe 邮箱上的代理地址。

Set-AddressRewriteEntry "joe@contoso.com to support@nortwindtraders.com" -Name "joe@contoso.com to support@northwindtraders.net" -ExternalAddress support@northwindtraders.net -OutboundOnly $true

修改单个域或子域的地址重写条目

若要修改可重写单个域或子域中的电子邮件地址的地址重写条目,请使用以下语法。

Set-AddressRewriteEntry <AddressRewriteEntryIdentity> [-Name "<Descriptive Name>"] [-InternalAddress <domain or subdomain>] [-ExternalAddress <domain>] [-OutboundOnly <$true | $false>]

此示例更改地址重写条目“Northwind Traders 重写为 Contoso”的内部地址值。

Set-AddressRewriteEntry "Northwindtraders to Contoso" -InternalAddress northwindtraders.net

修改多个子域的地址重写条目

若要修改可重写某个域及其所有子域中的电子邮件地址的地址重写条目,请使用以下语法。

Set-AddressRewriteEntry <AddressRewriteEntryIdentity> [-Name "<Descriptive Name>"] [-InternalAddress *.<domain>] [-ExternalAddress <domain>] [-ExceptionList <list of domains>]

若要替换地址重写条目的现有例外列表值,请使用以下语法:

Set-AddressRewriteEntry <AddressRewriteEntryIdentity> -ExceptionList <domain1,domain2,...>

此示例将地址重写条目"Contoso 重写为 Northwind"的现有例外列表值替换为 marketing.contoso.com 和 legal.contoso.com:

Set-AddressRewriteEntry "Contoso to Northwind Traders" -ExceptionList sales.contoso.com,legal.contoso.com

若要在不影响其他例外条目的情况下添加或删除例外列表值,请使用以下语法:

Set-AddressRewriteEntry <AddressRewriteEntryIdentity> -ExceptionList @{Add="<domain1>","<domain2>"...; Remove="<domain3>","<domain4>"...}

此示例在地址重写条目"Contoso 重写为 Northwind Traders"的例外列表中添加 finanace.contoso.com,并从中删除 marketing.contoso.com:

Set-AddressRewriteEntry "Contoso to Northwind Traders" -ExceptionList @{Add="finanace.contoso.com"; Remove="marketing.contoso.com"}

有关详细信息,请参阅 Set-AddressRewriteEntry

如何知道操作成功?

若要验证是否已成功修改地址重写条目,请执行以下操作:

  1. AddressRewriteEntryIdentity> 替换为<地址重写条目的名称,并运行以下命令来验证属性值:

    Get-AddressRewriteEntry <AddressRewriteEntryIdentity> | Format-List
    
  2. 从受到地址重写条目影响的邮箱向外部邮箱发送一封测试邮件。 验证测试邮件是否看起来好像来自重写的电子邮件地址。

  3. 从外部邮箱回复测试邮件。 验证原始邮箱是否收到回复。

使用 Exchange 命令行管理程序 删除地址重写条目

若要删除单个地址重写条目,请使用以下语法:

Remove-AddressRewriteEntry <AddressRewriteEntryIdentity>

此示例删除名为"Contoso.com 重写为 Northwindtraders.com"的地址重写条目:

Remove-AddressRewriteEntry "Contoso.com to Northwindtraders.com"

若要删除多个地址重写条目,请使用以下语法:

Get-AddressRewriteEntry [<search criteria>] | Remove-AddressRewriteEntry [-WhatIf]

此示例删除所有地址重写条目:

Get-AddressRewriteEntry | Remove-AddressRewriteEntry

此示例模拟删除名称中包含"重写为 contoso.com"文本的地址重写条目。 WhatIf 开关允许预览结果,而无需提交任何更改。

Get-AddressRewriteEntry "*to contoso.com" | Remove-AddressRewriteEntry -WhatIf

如果对结果感到满意,请再次运行命令,而不使用 WhatIf 开关删除地址重写条目。

Get-AddressRewriteEntry "*to contoso.com" | Remove-AddressRewriteEntry

有关详细信息,请参阅 Remove-AddressRewriteEntry

如何知道操作成功?

若要验证是否已成功删除地址重写条目,请执行以下操作:

  1. 运行 命令 Get-AddressRewriteEntry,并验证删除的地址重写条目是否未列出。

  2. 从受到地址重写条目影响的邮箱向外部邮箱发送一封测试邮件。 验证测试邮件不再受到已删除的地址重写条目影响。

  3. 从外部邮箱回复测试邮件。 验证原始邮箱是否收到回复,并且该邮件是否不受已删除的地址重写条目影响。