EmailAddress
Learn how to manage destination email addresses for Cloudflare email routing using Alchemy.
Manage destination email addresses that can receive emails forwarded by Cloudflare email routing rules.
Minimal Example
Section titled “Minimal Example”Add a destination email address:
import { EmailAddress } from "alchemy/cloudflare";
await EmailAddress("admin-email", { email: "admin@company.com",});
Multiple Destination Addresses
Section titled “Multiple Destination Addresses”Create multiple destination addresses for different purposes:
import { EmailAddress } from "alchemy/cloudflare";
const supportEmail = await EmailAddress("support-email", { email: "support@company.com",});
const salesEmail = await EmailAddress("sales-email", { email: "sales@company.com",});
const adminEmail = await EmailAddress("admin-email", { email: "admin@company.com",});
Email Verification
Section titled “Email Verification”Email addresses must be verified before they can receive forwarded emails:
import { EmailAddress } from "alchemy/cloudflare";
const emailAddress = await EmailAddress("my-email", { email: "destination@company.com",});
// Check verification statusconsole.log(`Verified: ${emailAddress.verified}`);
Special Characters in Email
Section titled “Special Characters in Email”Handle email addresses with special characters:
import { EmailAddress } from "alchemy/cloudflare";
await EmailAddress("special-email", { email: "user+tag@example.com",});
await EmailAddress("subdomain-email", { email: "admin@subdomain.example.com",});
Properties
Section titled “Properties”Input Properties
Section titled “Input Properties”email
(string): Destination email address for routingverified
(boolean, optional): Whether to automatically verify the email address if possible. Note: Verification typically requires email confirmation by the recipient. Defaults tofalse
Output Properties
Section titled “Output Properties”email
(string): The email addressverified
(boolean): Whether the email address has been verifiedcreated
(string): When the email address was createdmodified
(string): When the email address was last modifiedtag
(string): Email address tag
Email Verification Process
Section titled “Email Verification Process”- Create Address: When you create an EmailAddress resource, it’s added to your account but starts unverified
- Verification Email: Cloudflare sends a verification email to the destination address
- User Confirms: The recipient must click the verification link in the email
- Address Verified: Once verified, the address can receive forwarded emails
Using with Email Rules
Section titled “Using with Email Rules”Destination addresses are used in email routing rules:
import { EmailAddress, EmailRule } from "alchemy/cloudflare";
const adminEmail = await EmailAddress("admin-email", { email: "admin@company.com",});
await EmailRule("admin-forwarding", { zone: "example.com", name: "Forward admin emails", matchers: [ { type: "literal", field: "to", value: "admin@example.com", }, ], actions: [ { type: "forward", value: [adminEmail.email], }, ],});
Best Practices
Section titled “Best Practices”Email Address Management
Section titled “Email Address Management”- Verify Quickly: Ask recipients to check their email and verify addresses promptly
- Use Descriptive Names: Use clear resource names that indicate the address purpose
- Monitor Status: Check verification status before setting up routing rules
Security Considerations
Section titled “Security Considerations”- Trust Recipients: Only add email addresses you trust to receive forwarded emails
- Review Regularly: Periodically review and remove unused destination addresses
- Limit Access: Consider who has access to destination addresses in your organization
Limitations
Section titled “Limitations”- Email addresses must be verified before they can receive forwarded emails
- Verification requires action from the email recipient
- Some email providers may block or filter forwarded emails
Troubleshooting
Section titled “Troubleshooting”Address Not Receiving Emails
Section titled “Address Not Receiving Emails”- Check Verification: Ensure the address is verified
- Check Spam Folder: Verification emails might be in spam
- Retry Verification: Delete and recreate the address if needed
Verification Email Not Received
Section titled “Verification Email Not Received”- Check Email Provider: Some providers block automated emails
- Try Different Address: Use an alternative email address if possible
- Contact Support: Reach out to Cloudflare support for assistance