Exchange Onlineにてユーザーが配布グループのアドレスからメールを送信する方法(fromアドレスを別のものにする方法)

皆さんこんにちは。胡田です。相当久しぶりにブログを書いています。

このExchange Serverブログに関しては前回更新が2014年4月8日とのことなので、3年以上更新しておらず…。月日の流れというのは恐ろしいものですね。

Exchange Serverに関しては一時期非常にDeepに取り組んだので過去、私の一番の得意分野でしたが気がつけばもう10年くらいはまともに触っていない状況な気がします。環境もオンプレミスでExchange Serverを構築するのが当たり前…というかそれしか選択肢が現実的になかった時代もありましたが、今ではExchange Onlineが相当普及してきた印象です。本質的に重要ではない部分に時間を取られなくなって良くなった面が非常に大きいように感じています。サーバーのサイジング、拡張可能なアーキテクチャ設計、Notes環境の接続等当時私が相当ノウハウをためた部分がほぼ意味がなくなっている面もありますが、製品、アーキテクチャとしてはかなり成熟しており、今でも質問をうけてもぱっとあたりをつけられるのはありがたいなと思います。

 

閑話休題。

今回はExchange Online(に限った話ではないのですが)にて、外部にメールを送信する際に、自分のメールアドレスではないアドレスで外部に送信する方法に関してです。

下記の状況を考えます。

 

ユーザーが1人います。操作の主体です。masahiko@ebisuda.onmicrosoft.com

image

グループが1つあります。今回このグループのアドレスからメールが送信されたように見せたいわけです。test@ebisuda.onmicrosoft.com

image

※今回、「配布グループ」でテストしたかったのですが、配布グループを作成しようとしても強制的にOffice 365グループになってしまいました。挙動は全く同じだと思いますので、このまま進めます。

この状態で、masahiko@ebisuda.onmicrosoft.comから外部にメールを出すともちろんmasahiko@ebisuda.onmicrosoft.comが差出人になります。

以下はOWAでメールを作成している所です。

image

以下は該当メールをgmailで受信した所です。

image

迷惑メールになってしまいましたが(笑

さて、この状態で、masahiko@ebisuda.onmicrosoft.comがtest@ebisuda.onmicrosoft.comからのメールを出そうとするとどうなるでしょうか。

操作としては「差出人」を設定することで行なえる…

image

のですが、差出人には自分しか表示されず、切り替えることができません。

image

 

非常にわかりづらいのですが、実はこの部分は編集、削除することができます。右クリックするとメニューが表示されます。

imageですが、私の環境では「編集」は動作しませんでした。一度「削除」してからアドレスを選択しました。

ですが、送信するとすぐにエラーとなります。

image

というわけで、「差出人として送信する」という権限が必要な事がわかります。

権限といえばPermission。Exchange Onlineの管理といえばPowerShell…ということで、Exchangeの管理用コマンドレットからPermissionという単語を含むものを検索します。

PowerShellでのExchange Onlineへの接続が必要なので以下の記事も参考に…。

 

以下のスクリプトを実行します。

 

#Exchange Onlineへの接続
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

#Permissionという単語を含むコマンドレットの検索
Get-Command *Permission*

 

実行結果は以下です。

 

PS C:\Users\mebisuda> Get-Command *Permission*

CommandType     Name                                               Version    S
                                                                              o
                                                                              u
                                                                              r
                                                                              c
                                                                              e
———–     —-                                               ——-    –
Alias           Get-AdlStoreItemPermission                         3.0.0      A
Alias           Set-AdlStoreItemPermission                         3.0.0      A
Function        Add-MailboxFolderPermission                        1.0        t
Function        Add-MailboxPermission                              1.0        t
Function        Add-PublicFolderClientPermission                   1.0        t
Function        Add-RecipientPermission                            1.0        t
Function        Get-MailboxFolderPermission                        1.0        t
Function        Get-MailboxPermission                              1.0        t
Function        Get-PublicFolderClientPermission                   1.0        t
Function        Get-RecipientPermission                            1.0        t
Function        Remove-MailboxFolderPermission                     1.0        t
Function        Remove-MailboxPermission                           1.0        t
Function        Remove-PublicFolderClientPermission                1.0        t
Function        Remove-RecipientPermission                         1.0        t
Function        Set-MailboxFolderPermission                        1.0        t
Cmdlet          Get-AzureRmDataLakeStoreItemPermission             3.0.0      A
Cmdlet          Set-AzureRmDataLakeStoreItemPermission             3.0.0      A

 

Add-RecipientPermissionというコマンドレットがありますね。

 

Get-Helpコマンドでヘルプを見てみます。

 

PS C:\Users\mebisuda> Get-Help Add-RecipientPermission

名前
    Add-RecipientPermission
   
概要
    This cmdlet is available only in the cloud-based service.
   
    Use the Add-RecipientPermission cmdlet to add SendAs permission to users in a cloud-based organization.
   
    For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.
   
   
構文
    Add-RecipientPermission -Identity <RecipientIdParameter> -AccessRights <MultiValuedProperty> -Trustee <SecurityPrincipalIdParameter> [-Confirm <SwitchPa
    rameter>] [-WhatIf <SwitchParameter>] [<CommonParameters>]
   
   
説明
    When a user is assigned SendAs permission to a user or group, the user can send messages that appear to come from the other user or group.
   
    You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have a
    ccess to some parameters if they’re not included in the permissions assigned to you. To see what permissions you need, see the “Recipient provisioning p
    ermissions” section in the Recipients Permissions topic.
   

関連するリンク
    Online Version http://technet.microsoft.com/EN-US/library/0740023b-47df-4f36-bcb9-ce3b0707a6d4(EXCHG.160).aspx

注釈
    例を参照するには、次のように入力してください: “get-help Add-RecipientPermission -examples”.
    詳細を参照するには、次のように入力してください: “get-help Add-RecipientPermission -detailed”.
    技術情報を参照するには、次のように入力してください: “get-help Add-RecipientPermission -full”.
    オンライン ヘルプを参照するには、次のように入力してください: “get-help Add-RecipientPermission -online”

 

ビンゴ!ですね。

 

 

結局以下のコマンドで権限の付与が行なえます。

 

PS C:\Users\mebisuda> Add-RecipientPermission -Identity test@ebisuda.onmicrosoft.com -AccessRights SendAs -Trustee masahiko@ebisuda.onmicrosoft.com

Identity        Trustee  AccessControlType AccessRights Inherited
——–        ——-  —————– ———— ———
test_84c6f4d24d masahiko Allow             {SendAs}     False   

 

AccessRightsとして「SendAs」が付与された状態です。これで「差出人」になれるわけですね。

コマンド実行後はそれが反映されるまでしばらく時間がかかります。2時間程度は反映に時間がかかると思っておいてもらうと良いと思います。

 

image

「差出人」を書き換えて、メールを送信します。初回は必ず差出人を手動で書き換える必要があるようです。

 

image

意図したとおり、test@ebisuda.onmicrosoft.comを差出人のアドレスとしてメールを送信することができました。

 

一度送信に成功すると、次回からはドロップダウンから選択できるようになります。

image

 

 

これで、目的を達成することができました。


Posted

in

by

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.