Component Integration
Embeddable Webmail Frame & SDK
Mount a full or component-level webmail client directly into any third-party web application, portal, or dashboard using a standalone iFrame or the official Envelark JavaScript SDK.
1. Standalone iFrame Embed
Embed the /embed/frame endpoint directly into your HTML with standard parameters:
<iframe
src="https://envelark.com/embed/frame?component=inbox&mailbox=all&embedded=true"
width="100%"
height="720"
frameborder="0"
style="border: 1px solid #E5DCCE; border-radius: 8px; box-shadow: 0 4px 16px rgba(31,61,46,0.06);"
allow="clipboard-write; clipboard-read"
title="Envelark Embedded Webmail">
</iframe>
2. Envelark JavaScript SDK
Include envelark.js for dynamic mounting, cross-origin communication, and cleanup:
<!-- 1. Include SDK script -->
<script src="https://envelark.com/embed/envelark.js"></script>
<!-- 2. Target container -->
<div id="inbox-container"></div>
<!-- 3. Initialize mount -->
<script>
const instance = Envelark.mount("#inbox-container", {
token: "YOUR_EMBED_TOKEN",
component: "inbox",
mailbox: "support@example.com",
width: "100%",
height: "720px",
theme: {
primaryColor: "#1F3D2E",
backgroundColor: "#F7F1E8"
}
});
// Example: postMessage to iframe ({ source: "envelark_parent", action: "refresh" })
instance.sendMessage({ action: "refresh" });
</script>
3. Frame Query Parameters
| Parameter | Default | Description |
|---|---|---|
component |
inbox |
Defines the view mode: inbox (thread list), thread (single conversation reading pane), or composer. |
mailbox |
all |
Filter to a specific authorized mailbox address (e.g. support@example.com) or all for unified inboxes. |
embedded |
true |
Hides outer header chrome and collapses navigation margins to fit cleanly into parent containers. |
token |
Optional | Session/app token (YOUR_EMBED_TOKEN) passed by Envelark.mount() for scoped member context. |
theme / primary_color / bg_color |
envelark |
Preset theme name or custom hex color tokens passed automatically when options.theme ({ primaryColor, backgroundColor }) is provided to Envelark.mount(). |
4. Allowed Origins & Security Controls
- Frame Headers (Current Runtime Behavior): All non-embed routes send
X-Frame-Options: SAMEORIGIN(p/index.php:24-26). On/embed/*routes (such as/embed/frame),X-Frame-Optionsis intentionally omitted so host applications can mount the iframe, andContent-Security-Policy-Report-Onlysendsframe-ancestors 'self'in report-only mode without blocking cross-origin framing (p/index.php:27). - Developer App Origin Configuration: The
allowed_domainscolumn indeveloper_appsand the organization domain panel (/admin/domains) store configured host origins for workspace integrations. - Permissions Policy: Clipboard access (
allow="clipboard-write; clipboard-read") is enabled on the iframe element so users can copy attachment fingerprints and email addresses.
5. Deep White-Labeling & Custom Domains
Envelark provides complete zero-assumption white-labeling. Customizations are dynamically injected into CSS variables and template assets:
Brand Identity
- Logo URL: Injected into the topbar and email signature blocks.
- Favicon: Custom SVG or PNG favicon icon.
- Zero Badges: Remove all "Powered by Envelark" badges on Business & Enterprise plans.
Custom CNAME Mapping
- Custom Host: Point
mail.yourproduct.comvia CNAME. - Tenant Isolation: Automatically resolved by
TenantService::resolveCurrentTenant()based on the incomingHostheader.
Customizable CSS Color Tokens
:root {
--brand-primary: #1F3D2E; /* Main brand tone & headings */
--brand-secondary: #D7C3A5; /* Subtle accents & borders */
--brand-accent: #C46F4E; /* Interactive buttons & chips */
--brand-background: #F7F1E8; /* Page background */
--brand-surface: #FFFFFF; /* Cards & reading pane */
}
6. postMessage Inter-Frame Communication
Communicate securely between your parent application and the embedded iframe:
Parent iFrame
// Send message from parent to Envelark iframe
iframeEl.contentWindow.postMessage({
source: 'envelark_parent',
action: 'select_thread',
thread_id: 104
}, 'https://envelark.com');
iFrame Parent
// Listen for events emitted by Envelark iframe
window.addEventListener('message', (event) => {
if (event.data?.source === 'envelark_child') {
console.log('Envelark Event:', event.data.event, event.data.payload);
}
});