Search code examples
phpemailgoogle-apigoogle-drive-apigoogle-api-php-client

how to remove/fix the warning from mail "this mail outside the organization" the access given by Google Drive API


public function shareGoogleSheet(Google_Service_Drive $service, string $email, array $role, string $spreadsheetId, string $name)
{
    $newPermission = new Google_Service_Drive_Permission();
    $newPermission->setEmailAddress($email);
    $newPermission->setType(self::SHARED_TYPE);
    $newPermission->setRole($role);
    try {
        $service->permissions->create($spreadsheetId, $newPermission);
    } catch (\Exception $e) {
        $this->logger->error($name . $e->getMessage());
    }
}

The Code that's I'm using for sharing the mails. Now I configured the service account for sharing the mails...

Warning images


Solution

  • In the end the problem you are facing has nothing to do with the API and more with the configuration of your domain.

    Contact the administrator so he can change the settings: