GitHub user FrancescoCastaldi added a comment to the discussion: Sending
messages via email on the dashboard is not working
In `superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx`,
the failure of the **Share by Email** action typically boils down to two
specific causes:
### 1. The `getDashboardPermalink` Return Value Type
In earlier Superset versions, `getDashboardPermalink` returned a Promise
resolving to a string URL. In recent versions, `getDashboardPermalink` resolves
to an object: `{ key: string, url: string }`.
When your code executes:
```tsx
const encodedBody = encodeURIComponent(
`${emailBody}${await generateUrl()}`,
);
```
If `generateUrl()` returns `{ key, url }`, string interpolation produces
`[object Object]` or causes the URL calculation to break.
**Fix:** Destructure the `url` property explicitly:
```tsx
async function generateUrl() {
const result = await getDashboardPermalink({
dashboardId,
dataMask,
activeTabs,
anchor: dashboardComponentId,
});
return typeof result === 'string' ? result : result.url;
}
```
### 2. Permalink REST API Permissions and Failures
The function `getDashboardPermalink` sends a POST request to
`/api/v1/dashboard/{id}/permalink`.
If that request fails (for instance with HTTP 401, 403, or 500), execution
immediately enters the `catch` block and displays the error toast.
- Verify in your browser's Developer Tools (Network tab) whether the POST
request to `/api/v1/dashboard/{id}/permalink` succeeds.
- If it returns 403 Forbidden, ensure that the user's role has the required
permission:
`can write on DashboardPermalinkRestApi` (or `all_datasource_access`).
### 3. OS Mailto Handler Protocol
Setting `window.location.href = mailto:...` relies on the operating system
having a registered default email client (such as Outlook, Thunderbird, or a
configured webmail handler in Chrome). If no default client is registered, the
browser silently ignores the navigation without throwing a JavaScript error.
Testing `window.open(mailtoUrl, '_blank')` or verifying system mail
associations confirms whether the client environment is intercepting the scheme.
GitHub link:
https://github.com/apache/superset/discussions/45341#discussioncomment-19164448
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]