Web3 Email Integration (Mailchain, EtherMail)
A classic dApp communication problem: you have the user's wallet address, but no way to send them a notification. Email requires registration, push notifications require explicit browser permission, and users don't monitor on-chain events constantly. Web3 email solves this by linking a mail address to a wallet without traditional email registration.
Mailchain
Mailchain uses a wallet address as a mailbox: [email protected]. The protocol stores encrypted messages decentrally; users read them through a Mailchain client or API, authenticating with a wallet signature.
Sending from the backend:
import { Mailchain } from '@mailchain/sdk';
const mailchain = Mailchain.fromSecretRecoveryPhrase(process.env.MAILCHAIN_SECRET!);
await mailchain.sendMail({
from: await mailchain.user().address, // your app's address
to: ['[email protected]'],
subject: 'Your transaction was confirmed',
content: {
text: 'Transaction 0xabc... confirmed in block 19000000',
html: '<p>Transaction <b>0xabc...</b> confirmed</p>',
},
});
Mailchain supports addressing by ENS names ([email protected]), Lens Protocol, XMTP, and other protocols.
EtherMail
EtherMail is a more marketing-oriented product: users register [email protected], linking it to a wallet. For senders (projects), there's an API for email campaigns with on-chain audience segmentation.
Integration via REST API — standard HTTP POST with JWT authorization. Better suited for mass mailings (airdrop notifications, governance alerts) than for transactional messages.
XMTP as an alternative
XMTP (Extensible Message Transport Protocol) is an open protocol for peer-to-peer messaging between wallets. Not email in the classical sense, but solves the same problem: notify a user by wallet address.
import { Client } from '@xmtp/xmtp-js';
import { Wallet } from 'ethers';
const signer = new Wallet(process.env.PRIVATE_KEY!);
const xmtp = await Client.create(signer, { env: 'production' });
const conversation = await xmtp.conversations.newConversation('0xRecipient...');
await conversation.send('Your limit order was filled at $2,450');
Before sending, check that the recipient is registered with XMTP: await Client.canMessage('0xAddress'). Sending to an unregistered address throws an exception.
When to use what
Mailchain — for transactional notifications with rich content (HTML), when the user is already in the Mailchain ecosystem.
EtherMail — for marketing campaigns with segmentation by on-chain criteria.
XMTP — for real-time p2p communication inside a dApp (chat between traders, protocol notifications).
None of these protocols covers 100% of users — most wallets are not registered in any of them. For reliable notification delivery, optional email collection during onboarding is still necessary.







