App-wsgetmail

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


Given a Message object, retrieves the full message content, delivers it
using the `mda`, and then executes the configured post-fetch
action. Returns a boolean indicating success.

## post\_fetch\_action($message)

Given a Message object, executes the configured post-fetch action. Returns a
boolean indicating success.

# CONFIGURATION

## Configuring Microsoft 365 Client Access

To use wsgetmail, first you need to set up the app in Microsoft 365.
Two authentication methods are supported:

- Client Credentials

    This method uses shared secrets and is preferred by Microsoft.
    (See [Client credentials](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#client-credentials))

- Username/password

    This method is more like previous connections via IMAP. It is currently
    supported by Microsoft, but not recommended. (See [Username/password](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#usernamepassword))

This section walks you through each piece of configuration wsgetmail needs,
and how to obtain it.

- tenant\_id

    wsgetmail authenticates to an Azure Active Directory (AD) tenant. This
    tenant is identified by an identifier that looks like a UUID/GUID: it should
    be mostly alphanumeric, with dividing dashes in the same places as shown in
    the example configuration above. Microsoft documents how to find your tenant
    ID, and create a tenant if needed, in the ["Set up a tenant"
    quickstart](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-create-new-tenant). Save
    this as the `tenant_id` string in your wsgetmail configuration file.

- client\_id

    You need to register wsgetmail as an application in your Azure Active
    Directory tenant. Microsoft documents how to do this in the ["Register an
    application with the Microsoft identity platform"
    quickstart](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app#register-an-application),
    under the section "Register an application." When asked who can use this
    application, you can leave that at the default "Accounts in this
    organizational directory only (Single tenant)."

    After you successfully register the wsgetmail application, its information
    page in your Azure account will display an "Application (client) ID" in the
    same UUID/GUID format as your tenant ID. Save this as the `client_id`
    string in your configuration file.

    After that is done, you need to grant wsgetmail permission to access the
    Microsoft Graph mail APIs. Microsoft documents how to do this in the
    ["Configure a client application to access a web API"
    quickstart](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-configure-app-access-web-apis#application-permission-to-microsoft-graph),
    under the section "Add permissions to access Microsoft Graph." When selecting
    the type of permissions, select "Application permissions." When prompted to
    select permissions, select the following items:

    - Mail.Read
    - Mail.ReadWrite

### Configuring client secret authentication

We recommend you deploy wsgetmail by configuring it with a client
secret. Client secrets can be granted limited access to only the mailboxes
you choose. You can adjust or revoke wsgetmail's access without interfering
with other applications.

Microsoft documents how to create a client secret in the ["Register an
application with the Microsoft identity platform"
quickstart](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app#add-a-client-secret),
under the section "Add a client secret." Take care to record the secret
token when it appears; it will never be displayed again. It should look like
a completely random string, not a UUID/GUID.

- global\_access

    Set this to `1` in your wsgetmail configuration file.

- secret

    Set this to the secret token string you recorded earlier in your wsgetmail
    configuration file.

- username

    wsgetmail will fetch mail from this user's account. Set this to an email
    address string in your wsgetmail configuration file.

### Configuring user+password authentication

If you do not want to use a client secret, you can also configure wsgetmail
to authenticate with a traditional username+password combination. As noted
above, this method is not recommended by Microsoft. It also does not work
for systems with federated authentication enabled.

- global\_access

    Set this to `0` in your wsgetmail configuration file.

- username

    wsgetmail will authenticate as this user. Set this to an email address
    string in your wsgetmail configuration file.

- user\_password

    Set this to the password string for `username` in your wsgetmail
    configuration file.

### Configuring Microsoft Government Cloud

If you are connecting to a Microsoft Government Cloud tenant (GCC High or
DoD), the default Microsoft Graph API and OAuth endpoints will not work. Use
the following options to point wsgetmail at the correct endpoints.



( run in 0.646 second using v1.01-cache-2.11-cpan-0b5f733616e )