私は内部アプリケーションのGmail APIを使用しています。 adminアカウントを使用しているすべてのユーザーの受信メールと送信メールの電子メール転送を設定する必要があります。私はYiiでGoogle PHP APIクライアントライブラリを使用しています。GMail API(PHP)を使用しているすべてのユーザーの転送先アドレスを設定する
この記事は次のとおりです。
以下は私がやろうとしていることです。
define('JSON_FILE', '/path/to/json/file');
$user_to_impersonate = '<My domain wide authorized admin email address>';
$scopes = [ \Google_Service_Gmail::GMAIL_SETTINGS_SHARING,\Google_Service_Gmail::MAIL_GOOGLE_COM];
$google_client = new \Google_Client();
$google_client->setAuthConfig(CLIENT_SECRET_PATH);
$google_client->setScopes($scopes);
$google_client->setSubject($user_to_impersonate);
$google_client->setIncludeGrantedScopes(true);
// setup the forwarding address
$service = new \Google_Service_Gmail($google_client);
$f = new \Google_Service_Gmail_AutoForwarding();
$f->setEnabled(TRUE);
$f->setEmailAddress('<my forwarding email address>');
$f->setDisposition("leaveInInbox");
$service->users_settings->updateAutoForwarding('me',$f)
私は何かが正しい:)ではないことを知っている
Unrecognized forwarding address
、次のエラーを取得します。誰かが私にこの問題を解決するための専門家の回答を知らせてもらえますか?私は使用している電子メールアドレスの転送を設定しようとしていますが、ではなく、すべてのユーザーに対してです。しかし、私は組織のGmailアカウント内のすべてのメールに同じメールアドレスを設定したいと思います。
ありがとうございます!