転送の管理
[設定] を使用して、アカウントの転送を構成できます。転送先のメールアドレスとして使用するには、アドレスが次のいずれかの条件を満たしている必要があります。
- メールアドレスが確認されました。詳細については、転送先住所の作成と確認をご覧ください。
- メールアドレスが送信者と同じドメインに属している。
- メールアドレスが送信者の同じドメイン内のサブドメインに属している。
- メールアドレスが、同じ Google Workspace アカウントの一部として構成されたドメイン エイリアスに属している。
転送先のメールアドレスがこれらのルールのいずれにも準拠していない場合、API を使用して転送を設定することはできません。
転送先アドレスの作成、一覧表示、取得、削除方法については、ForwardingAddresses リファレンスをご覧ください。
転送設定を取得または更新する方法については、設定リファレンスをご覧ください。
転送先アドレスの作成と確認
転送アドレスを使用する前に、転送アドレスを作成する必要があります。場合によっては、住所の所有権の確認も必要になります。
Gmail で転送先住所のユーザー確認が必要な場合、その住所はステータス pending
で返されます。確認メッセージが、対象のメールアドレスに自動的に送信されます。メールアドレスを使用するには、メールアドレスの所有者が確認プロセスを完了する必要があります。
確認が不要な転送先住所の確認ステータスは accepted
です。
自動転送を有効にする
updateAutoForwarding メソッドを呼び出して、アカウントの自動転送を有効にします。この呼び出しには、登録済みで確認済みの転送先アドレスと、転送されたメールに対して行う操作の両方が必要です。
たとえば、自動転送を有効にして転送されたメールをゴミ箱に移動するには:
自動転送を無効にするには、updateAutoForwarding を呼び出して、enabled
プロパティを false
に設定します。
特定のメッセージを転送する
自動転送では、受信したすべてのメールが移行先のアカウントに転送されます。メールを選択的に転送するには、フィルタを使用して、メールの属性またはコンテンツに応じて転送するルールを作成します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-01-15 UTC。
[null,null,["最終更新日 2025-01-15 UTC。"],[[["Email forwarding requires the forwarding address to be verified, belong to the same domain or a subdomain, or be part of the same Google Workspace account."],["You can create, list, get, and delete forwarding addresses, as well as enable and disable auto-forwarding, using the Gmail API."],["Forwarding addresses may require user verification; if so, they will have a \"pending\" status until verified."],["Auto-forwarding can be enabled to send all incoming messages to a designated address, and it can be configured to move forwarded messages to the trash."],["To forward specific messages based on attributes or content, utilize Gmail filters to create forwarding rules."]]],["To enable email forwarding, first create a forwarding address using the API, ensuring it's either verified, within the same domain, a subdomain, or a domain alias. If verification is needed, a `pending` status is returned; once verified, it becomes `accepted`. Use `updateAutoForwarding` to enable forwarding, specifying the address and the action for forwarded messages (e.g., move to trash). To disable, set `enabled` to `false`. For selective forwarding, use filters.\n"]]