Skip to main content

Custom Email with Subdomain: Setup Guide

Guide about Custom Email with Subdomain: Setup Guide

Written by Mayank Baswal

Founder of is-cool-me · DNS & Platform Infrastructure

Mayank Baswal maintains the is-cool-me platform and writes technical guides focused on DNS configuration, subdomain infrastructure, SSL troubleshooting, deployment workflows, and platform reliability.

Reviewed by is-cool-me Technical Review
## Introduction Custom email with subdomain is a crucial aspect of setting up a professional online presence for developers on the is-cool-me platform. Having a custom email address such as `support@myproject.is-pro.dev` not only enhances credibility but also provides a centralized and organized way to manage project-related communications. This comprehensive guide is designed to walk developers through the process of setting up custom email with their subdomain on is-cool-me, ensuring they can leverage the full potential of their project's online identity. The importance of custom email cannot be overstated, as it allows for better communication with team members, clients, and users, all while maintaining a consistent brand image. Moreover, with the rise of phishing and spam, having a custom email address associated with your project's subdomain can significantly improve the deliverability of your emails and reduce the risk of being flagged as spam. ## Prerequisites Before diving into the setup process, there are several prerequisites that developers need to fulfill. First, they must have an active is-cool-me account and have created a subdomain for their project, such as `myproject.is-pro.dev`. Additionally, they should have a basic understanding of DNS management, as setting up custom email involves configuring DNS records. It's also recommended that developers have a mail service provider (MSP) account, such as Mailgun or Sendgrid, which will handle the actual email sending and receiving. For this guide, we'll assume the use of Mailgun as our MSP. Lastly, having a text editor or IDE and access to the terminal/command prompt is necessary for executing commands and configuring settings. ## Step-by-step instructions To set up custom email with your subdomain, follow these detailed steps: 1. **Sign up for Mailgun**: If you haven't already, sign up for a Mailgun account. This will provide you with the necessary credentials to send and receive emails via your custom domain. 2. **Configure Mailgun DNS**: Log into your Mailgun account and go to the "Domains" section. Click on "Add New Domain" and enter your subdomain, e.g., `myproject.is-pro.dev`. Mailgun will provide you with a set of DNS records that need to be added to your is-cool-me subdomain settings. 3. **Add DNS records to is-cool-me**: Log into your is-cool-me account, navigate to your project's subdomain settings, and find the DNS management section. Add the DNS records provided by Mailgun. These typically include a TXT record for SPF (Sender Policy Framework) and a CNAME record for tracking and routing emails. 4. **Verify domain ownership**: Mailgun will require you to verify that you own the domain. This is usually done by adding a specific TXT record to your DNS settings or by uploading an HTML file to your domain. 5. **Configure email sending**: Once your domain is verified, you can configure email sending. This involves setting up a SMTP server or using Mailgun's API to send emails from your custom email address. Example of adding a TXT record for SPF using the `dig` command: ```bash dig +short TXT _spf.myproject.is-pro.dev ``` And an example of using Mailgun's API to send an email using Python: ```python import requests def send_email(subject, body, to): api_key = 'your_mailgun_api_key' domain = 'myproject.is-pro.dev' from_email = 'support@myproject.is-pro.dev' response = requests.post( f'https://api.mailgun.net/v3/{domain}/messages', auth=('api', api_key), data={'from': from_email, 'to': to, 'subject': subject, 'text': body}) return response.json() # Example usage send_email('Hello from myproject', 'This is a test email', 'recipient@example.com') ``` ## Configuration deep-dive When configuring custom email with your subdomain, there are several options and settings to consider. Here's a breakdown of some key configurations: - **MX Records**: These records are used to route incoming emails to your mail server. For Mailgun, you'll typically set your MX records to point to `mxa.mailgun.org` and `mxb.mailgun.org`. - **TXT Records**: These are used for SPF and DKIM (DomainKeys Identified Mail) configurations. SPF helps prevent spam by specifying which servers are allowed to send emails from your domain, while DKIM is used to verify the authenticity of emails. - **CNAME Records**: These are used to alias one domain name to another. In the context of Mailgun, CNAME records are used for tracking and routing emails. Here's an example configuration for `myproject.is-pro.dev`: | Record Type | Name | Value | |-------------|------|-------| | MX | @ | mxa.mailgun.org | | MX | @ | mxb.mailgun.org | | TXT | @ | v=spf1 include:mailgun.org ~all | | TXT | mailo._domainkey | k=rsa; p=MIGfMA0GCSqGSIb3... | | CNAME | email | mailgun.org | ## Common pitfalls and solutions Several common pitfalls can occur during the setup process: 1. **Incorrect DNS Records**: Ensure that your DNS records are correctly set up and propagated. You can use tools like `dig` or online DNS checkers to verify your records. 2. **Domain Verification Issues**: If you're having trouble verifying your domain with Mailgun, double-check that your TXT records are correctly set up and try verifying again after a few hours to allow for DNS propagation. 3. **Email Delivery Issues**: If your emails are not being delivered, check your SPF and DKIM configurations. Ensure that your mail server is correctly set up to handle emails from your custom domain. 4. **Mailgun API Errors**: When using the Mailgun API, make sure your API key is correct and that you're using the correct domain and from email address. 5. **Subdomain Configuration**: Ensure that your subdomain is correctly set up on is-cool-me and that you have the necessary permissions to manage its DNS settings. ## Best practices To ensure optimal performance, security, and maintainability: - **Monitor DNS Propagation**: Use tools to monitor DNS propagation and ensure that your records are correctly set up worldwide. - **Regularly Update SPF and DKIM**: Keep your SPF and DKIM records up to date to prevent email delivery issues. - **Use Secure Connections**: Always use secure connections (TLS) when sending and receiving emails. - **Test Email Sending and Receiving**: Regularly test sending and receiving emails from your custom email address to ensure everything is working correctly. ## Troubleshooting section When issues arise, here are some diagnostic steps to follow: 1. **Check DNS Records**: Verify that your DNS records are correctly set up and propagated. 2. **Mailgun Logs**: Check Mailgun's logs for any errors or issues related to email sending and receiving. 3. **Email Client Settings**: If you're using an email client, ensure that your settings are correct, including the SMTP server, port, and authentication details. 4. **Test Email Sending**: Use tools like `telnet` or Mailgun's API to test sending emails from your custom email address. 5. **Contact Support**: If none of the above steps resolve your issue, contact is-cool-me or Mailgun support for further assistance. ## Deployment scenario from operations Let's consider a real-world deployment scenario for `myproject.is-pro.dev`: - The project requires custom email addresses for support and marketing teams. - Mailgun is chosen as the MSP for its ease of use and reliability. - The development team sets up the necessary DNS records, including MX, TXT, and CNAME records, to route emails through Mailgun. - They configure Mailgun's API to send emails from `support@myproject.is-pro.dev` and `marketing@myproject.is-pro.dev`. - The team tests email sending and receiving to ensure everything is working as expected. - Finally, they monitor DNS propagation and Mailgun logs to catch any issues early on. ## Common mistakes Some common mistakes to avoid: * Incorrectly setting up DNS records, leading to email delivery issues. * Forgetting to verify domain ownership with Mailgun. * Using an incorrect API key or domain when sending emails via Mailgun's API. * Not regularly updating SPF and DKIM records. * Not testing email sending and receiving after setup. ## How to verify it works To verify that your custom email with subdomain is working: 1. **Send a Test Email**: Use Mailgun's API or an email client to send an email from your custom email address to an external email address. 2. **Check Email Delivery**: Verify that the email is delivered successfully and not marked as spam. 3. **Check Email Headers**: Inspect the email headers to ensure that SPF and DKIM checks pass. 4. **Test Email Receiving**: Send an email to your custom email address and verify that it's received correctly. 5. **Monitor Mailgun Logs**: Keep an eye on Mailgun's logs for any issues or errors related to email sending and receiving. ## Conclusion with next steps Setting up custom email with your subdomain on is-cool-me is a straightforward process that enhances your project's professional image and improves communication with your audience. By following the steps outlined in this guide, you can ensure a smooth setup process. Next steps include monitoring your email setup, regularly testing email sending and receiving, and exploring advanced features offered by your MSP, such as email tracking and analytics. ## FAQ **Q: What is the purpose of SPF and DKIM records?** A: SPF (Sender Policy Framework) and DKIM (DomainKeys Identified Mail) are email authentication techniques used to prevent spam and phishing attacks. SPF specifies which mail servers are allowed to send emails from your domain, while DKIM verifies the authenticity of emails by checking if the email was indeed sent by an authorized server. **Q: How long does DNS propagation take?** A: DNS propagation can take anywhere from a few minutes to 48 hours. It's the time it takes for DNS changes to be updated across the globe. You can use online tools to check the propagation status of your DNS records. **Q: Can I use a custom email address without setting up DNS records?** A: No, setting up the correct DNS records is crucial for custom email to work. These records route emails to your mail server and verify your domain ownership. **Q: What are the benefits of using a custom email address?** A: Custom email addresses enhance your professional image, improve deliverability, and reduce the risk of being flagged as spam. They also provide a centralized way to manage project-related communications. **Q: How do I troubleshoot email delivery issues?** A: Start by checking your DNS records and Mailgun logs for any errors. Then, test sending emails from your custom email address to an external email address. If issues persist, contact your MSP or is-cool-me support for further assistance.
Share this article Share on X Share on LinkedIn

Explore More