Send Emails DirectlyFrom Smart Contracts
Automate user notifications with smart contract integration. Send transaction confirmations, reward alerts, and governance notifications without any backend infrastructure.
Zero Backend, Maximum Automation
function claimRewards() external {
uint256 rewards = calculateRewards(msg.sender);
_transfer(rewardToken, msg.sender, rewards);
// Approve USDC for email fee
usdc.approve(address(mailer), mailer.getFee());
// Send email notification using prepared template
mailer.sendPrepared(
msg.sender,
"reward-notification", // template ID
false, // standard mode: 10% fee only
true // resolve sender name
);
}
Three Powerful Integration Types
Automate critical user communications directly from your smart contracts
Transaction Notifications
Automatically notify users about successful transactions, failed attempts, and pending confirmations.
Common Use Cases:
- DeFi swap confirmations with slippage details
- NFT purchase receipts with marketplace links
- Staking rewards claimed notifications
- Failed transaction alerts with gas estimation
- Cross-chain bridge completion updates
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IMailer {
function sendPrepared(
address to,
string calldata mailId,
bool revenueShareToReceiver,
bool resolveSenderToName
) external;
}
// Send email on successful swap
event SwapCompleted(address user, uint256 amountIn, uint256 amountOut);
function swap(uint256 amountIn) external {
// ... swap logic ...
emit SwapCompleted(msg.sender, amountIn, amountOut);
// Approve USDC for email fee (adjust based on fee structure)
usdc.approve(address(mailer), 10000); // 0.01 USDC for standard mode
// Trigger email notification using template
IMailer(mailerContract).sendPrepared(
msg.sender,
"swap-confirmation", // template ID
false, // standard mode: 10% fee only
true // resolve sender name
);
}
DeFi Protocol Events
Keep users informed about yield farming rewards, liquidation risks, and protocol changes.
Common Use Cases:
- Yield farming reward distributions
- Liquidation warnings at 110% collateral ratio
- New pool launches with bonus APY
- Governance proposal voting reminders
- Protocol fee changes and updates
// Monitor health factor and warn users
function checkHealthFactor(address user) external {
uint256 healthFactor = calculateHealthFactor(user);
if (healthFactor < 1.2e18) { // Below 120%
IMailBox(mailboxContract).sendEmail(
user,
"β οΈ Liquidation Risk Alert",
"liquidation-warning",
abi.encode(healthFactor, requiredCollateral)
);
}
}Governance & DAO
Automate governance communications and voting notifications for your DAO members.
Common Use Cases:
- New proposal creation announcements
- Voting deadline reminders (24h, 1h before)
- Proposal execution confirmations
- Delegation change notifications
- Treasury milestone updates
// Notify on new governance proposal
function createProposal(string calldata description) external {
uint256 proposalId = proposals.length;
// ... create proposal logic ...
// Email all token holders
IMailBox(mailboxContract).sendBulkEmail(
getAllTokenHolders(),
"π³οΈ New Governance Proposal",
"governance-proposal",
abi.encode(proposalId, description, block.timestamp + votingDelay)
);
}Built for Production
Enterprise-grade features that scale with your protocol
Gas Optimized
Minimal gas overhead - typically <5,000 gas per email
Optimized contract calls that don't impact your main transaction costs
Instant Delivery
Emails sent within seconds of transaction confirmation
Real-time processing with <3 second average delivery time
Template System
Pre-built templates for common use cases
Customizable HTML/text templates with dynamic data injection
Analytics Dashboard
Track email delivery and engagement metrics
Real-time analytics on open rates, clicks, and conversions
Multi-Chain Support
Deploy on any blockchain - we handle the complexity
Ethereum
Available Networks:
Ethereum sepolia
Available Networks:
Integration in 3 Simple Steps
Get started with smart contract email integration in under 10 minutes
Install the SDK
~2 minutesAdd MailBox to your smart contract project
npm install @sudobility/contracts
# or
yarn add @sudobility/contracts
# or
pnpm add @sudobility/contractsImport Interface
~1 minuteImport the IMailBox interface in your contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@sudobility/contracts/interfaces/IMailer.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract YourContract {
IMailer constant mailer = IMailer(0x...); // Mailer contract address
IERC20 constant usdc = IERC20(0x...); // USDC token address
}Send Emails
~5 minutesCall the sendEmail function from your contract logic
function notifyUser(address recipient) external {
// Approve USDC spending first (0.1 USDC for priority, 0.01 USDC for standard)
usdc.approve(address(mailer), 100000);
// Send priority email (recipient gets 90% fee back as claimable)
mailer.send(
recipient, // recipient address
"Transaction Complete", // email subject
"Your transaction was successful!", // email body
true, // revenueShareToReceiver: true = priority (90% share)
true // resolveSenderToName: resolve to ENS/SNS
);
// Or send standard email (10% fee only, no revenue share)
mailer.send(
recipient,
"Update Available",
"A new version is ready",
false, // revenueShareToReceiver: false = standard (10% fee only)
true // resolveSenderToName
);
// Or use prepared template (priority with revenue share)
mailer.sendPrepared(
recipient,
"tx-success-v1", // template ID
true, // priority mode with revenue share
true // resolve sender name
);
}
Advanced Features
Powerful capabilities for complex use cases
Conditional Logic
Send emails based on complex on-chain conditions
Bulk Operations
Email multiple users in a single transaction
Template Variables
Dynamic content based on transaction data
Retry Logic
Automatic retry for failed email deliveries
Success Stories
How protocols transformed their user experience with smart contract emails
Integration:
Automated reward notifications + liquidation warnings
"Smart contract emails reduced our liquidation events by 67%. Users now get timely warnings and can act before it's too late."
Integration:
Bid notifications + sale confirmations
"Automated bid notifications transformed our marketplace. Sellers respond faster and buyers stay engaged throughout auctions."
Integration:
Achievement unlocks + reward distributions
"Players love getting instant notifications when they unlock achievements. It's gamification taken to the next level."