I would like to write one function in php that opens a different Gmail mailbox based on an email address that is passed to the function.
- PHP function call -- Gmail_Open('[email protected]') -- opens the Foo account
- PHP function call -- Gmail_Open('[email protected]') -- opens the Baz account
I can do this for one account using the PHP QuickStart code and the instructions on the website. I need help accessing multiple accounts with no human interaction for authorization. It would be OK to establish the authorization once for the life of the application if that is required. Ultimately Gmail_Open() will become a custom API that is used only by our organization for email in our domain.
I saw the following code in the QuickStart:
// Print the labels in the user's account.
$user = 'me';
$results = $service->users_labels->listUsersLabels($user);
I tried changing 'me' to an email address but this did not work.
A push in the right direction would be helpful. Thanks!