- Why Email Marketing is Vital for Ecommerce
- Key Elements of an Email Marketing Strategy
- Technical infrastructure and email service selection (SMTP/ESP)
- DNS and authentication settings: SPF, DKIM, DMARC
- Setting up an email server (e.g. Postfix + OpenDKIM)
- IP warm-up, dedicated or shared, forwarding rate management
- Content design, segmentation, and automation for stores
- Monitoring, KPIs and performance analysis
- Compliance with email laws and security
- Scalability and offering related infrastructure services
- Practical checklist and quick tips
- Example DNS records (summary)
- curl example to send email via API (Mailgun)
- Special items for international stores
- Costs and economic decision-making
- Conclusion
- Frequently Asked Questions
Why Email Marketing is Vital for Ecommerce
Email is one of the most effective marketing channels for increasing sales, customer retention, and recovering abandoned carts. Its **high return on investment (ROI)** compared to paid channels is one of the main reasons why it is important.
In addition to promotional campaigns, emails transactional Like billing, order confirmation and shipping tracking have much higher engagement rates, which are critical to the customer experience.
Email marketing allows for **data-driven** and personalization based on user behavior, purchase history, and points, which helps increase CLV.
Key Elements of an Email Marketing Strategy
A complete strategy should encompass both business targeting and technical implementation.
Goal setting
Defining specific goals such as increasing sales, customer retention, abandoned cart recovery, and product education is a prerequisite for any program.
Segmentation
Segmentation based on RFM (Recency, Frequency, Monetary), browsing behavior, and email interactions helps you send targeted and relevant messages.
Content and automation
Optimized content includes a catchy title, preheader, clear CTA, and a mobile-friendly version. Automations like welcome, abandoned cart, and post-purchase should be designed.
Measurement
Key KPIs include open rate, CTR, conversion rate, bounce rate, and deliverability. Close monitoring of these metrics is essential for continuous improvement.
Technical infrastructure and email service selection (SMTP/ESP)
There are two general paths: using ESPs like Mailgun, SendGrid, or Amazon SES, or hosting an MTA on your own servers (Postfix, Exim).
Advantages and disadvantages:
- ESP: Simpler, scalable, dashboards and APIs; cost based on volume.
- Self-hosted: Full control over IP and output content, suitable for experienced DevOps teams; requires maintenance and resolving deliverability issues.
For online stores, a combination of both is usually recommended: transactional emails on dedicated servers or a service with a high SLA and promotional emails from an ESP to manage deliverability and feedback.
DNS and authentication settings: SPF, DKIM, DMARC
These three components are fundamental to deliverability, and without them, the likelihood of emails ending up in spam increases.
SPF
Place the sample SPF (TXT) record in the domain's DNS:
v=spf1 include:spf.protection.outlook.com include:mailgun.org ip4:203.0.113.45 -allDKIM
For DKIM, the public key must be in the TXT record and the private key must be on the signing server. Example TXT record for selector:
default._domainkey.example.com TXT "v=DKIM1; k=rsa; p=MIIBIjANB...AB"Example key generation commands (OpenDKIM):
mkdir -p /etc/opendkim/keys/example.com
opendkim-genkey -s default -d example.com -D /etc/opendkim/keys/example.com
# move default.private to /etc/opendkim/keys/example.com and publish the TXT record shown in the generated .txt fileDMARC
Example DMARC record for policy control and reporting:
v=DMARC1; p=quarantine; rua=mailto:[email protected]; ruf=mailto:[email protected]; pct=100; sp=noneSetting up an email server (e.g. Postfix + OpenDKIM)
Below is a sample deployment on Ubuntu/Debian that shows the key steps.
Installing packages:
sudo apt update
sudo apt install postfix opendkim opendkim-toolsSample configuration /etc/opendkim.conf:
AutoRestart Yes
Canonicalization relaxed/simple
Mode sv
Socket inet:12345@localhost
KeyTable /etc/opendkim/KeyTable
SigningTable refile:/etc/opendkim/SigningTable
TrustedHosts /etc/opendkim/TrustedHostsExample KeyTable and SigningTable:
default._domainkey.example.com example.com:default:/etc/opendkim/keys/example.com/default.private
*@example.com default._domainkey.example.comConnecting Postfix to OpenDKIM (main.cf):
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345
milter_default_action = acceptRestart services:
sudo systemctl restart opendkim postfixIP warm-up, dedicated or shared, forwarding rate management
IP Warm-up: Distributing submissions gradually from the new IP creates positive reputation for the IP.
Sample four-week program:
- Week 1: 200 emails/day
- Week 2: 800 emails/day
- Week 3: 2,500 emails/day
- Week 4: Increase to normal volume while maintaining open and engagement rates
Dedicated vs Shared:
- Dedicated: Suitable for large brands, requiring warm-up and maintaining IP reputation.
- Shared: Faster to start and less expensive, but may be affected by other users' behavior.
If you are using Postfix, consider rate limiting settings such as smtpd_client_message_rate_limit and smtpd_client_recipient_rate_limit.
Content design, segmentation, and automation for stores
Practical and automated segmentations can dramatically increase the efficiency of campaigns.
Practical divisions
- Customers with high CLV in the last 30 days
- One-time buyers who haven't made a purchase in 90 days
- Abandoned cart with products over X Tomans
Sample SQL query for WooCommerce/MySQL:
SELECT user_id, SUM(order_total) as lifetime_value, MAX(order_date) as last_order
FROM wp_wc_orders
GROUP BY user_id
HAVING lifetime_value > 500000 AND last_order > DATE_SUB(NOW(), INTERVAL 30 DAY);Sample Automation
Sample flows:
- Welcome flow: Welcome email + discount code in 3 steps over 7 days.
- Cart abandonment: Email 1 after 1 hour, email 2 after 24 hours, email 3 after 72 hours with discount.
- Post-purchase: Order confirmation, shipping notification, feedback request after 7 days.
Use tokens (customer name, last purchased product) and dynamic content based on product category for personalization.
Monitoring, KPIs and performance analysis
Key KPIs include Delivery Rate, Open Rate, CTR, Conversion Rate, Bounce Rate (soft/hard), Complaint Rate, and Revenue per Email.
Technical monitoring should include bounce rates at the MTA level, SMTP errors, status on blacklists like Spamhaus, and feedback loops from ESPs.
Tools: ESP reports, Google Analytics (with UTM for links), local logs (like /var/log/mail.log), and inbox placement tests.
Compliance with email laws and security
Important laws include GDPR, CAN-SPAM, and CASL. You should have explicit user consent, a clear unsubscribe option, and record keeping of consent.
Email server security:
- TLS (STARTTLS) for SMTP connection—example configuration in main.cf:
smtpd_tls_cert_file=/etc/ssl/certs/mail.example.com.crt
smtpd_tls_key_file=/etc/ssl/private/mail.example.com.key
smtpd_use_tls=yes- Restrict access with a firewall (ufw or iptables).
- Use anti-spam/antivirus such as amavisd, SpamAssassin, and ClamAV for incoming/outgoing emails.
- Protect against DDoS and use anti-DDoS servers and BGP network if needed to maintain access.
Scalability and offering related infrastructure services
For large, scalable campaigns, it is better to use message queuing and auto-scaling.
- Cloud servers with High IOPS for message queues and databases.
- CDN for hosting email images and reducing server load.
- Multi-region sending with locations close to target users to reduce latency and improve deliverability.
- Kubernetes or auto-scaling for dispatch workers, use of message queues (RabbitMQ, Redis) and fast bounce/complaint processing.
- Using GPU/Compute server to process advanced recommender models.
Practical checklist and quick tips
Before the campaign:
- SPF, DKIM, and DMARC are set up correctly.
- Set a PTR (reverse DNS) record for the sender's IP.
- IP warm-up is scheduled.
- Lists are cleared and double opt-in is enabled.
During execution:
- Reduce the sending rate if bounce or complaint rates increase.
- A/B test the headline and posting time.
- Keep blacklist monitoring and feedback loops active.
After the campaign:
- KPI and performance analysis based on segments.
- Remove hard bounces and add to suppression list.
- Improve content based on user interaction.
Example DNS records (summary)
Common examples to put in DNS:
example.com. TXT "v=spf1 ip4:203.0.113.45 include:mailgun.org -all"
default._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkq..."
_dmarc.example.com. TXT "v=DMARC1; p=quarantine; rua=mailto:[email protected]; pct=100"curl example to send email via API (Mailgun)
Sample API request with URL and parameters preserved:
curl -s --user 'api:YOUR_API_KEY' \
https://api.mailgun.net/v3/example.com/messages \
-F from='Shop <[email protected]>' \
-F to='[email protected]' \
-F subject='تایید سفارش شما' \
-F text='با تشکر از خرید شما...'Special items for international stores
It is essential to pay attention to local laws, localize content (language, currency), and manage time zones to post at the appropriate local times.
Using servers close to target users and multiple data center locations can help improve regional deliverability.
Costs and economic decision-making
ESP costs are based on volume, and self-hosting costs include server and MTA maintenance.
Calculating ROI is simple: revenue per email × number of emails = revenue; then deduct the cost of infrastructure and team to determine the true ROI.
In many cases, a combination of ESP for promotions and a dedicated server for transactional provides the best balance.
Conclusion
Implementing a successful email marketing strategy requires a combination of targeted content, smart segmentation, and reliable technical infrastructure.
From DNS authentication (SPF/DKIM/DMARC) and IP warm-up to appropriate automations and KPI monitoring, every step impacts deliverability and bottom line revenue.
The infrastructure team has access to 85+ global locations, high-performance cloud servers, a variety of dedicated and VPS servers, CDN, BGP network, and email/SMTP management services ready for technical support in implementation and optimization.
Support details and suggestions
If you need technical advice, a dedicated Warm-up program, or to view hosting plans and email services, you can contact support or review the plan details to ensure your store campaign runs smoothly.









