Articles in this section
Category / Section

Configuring a Custom Email Provider in Neostore with SendGrid

Published:
Updated:

Configuring a Custom Email Provider in Neostore

Article 1: Using Neostore’s SendGrid Account

Configuring Neostore to Use Neostore’s SendGrid Account

This guide will help you set up Neostore to use Neostore’s SendGrid account for sending emails.

Prerequisites

Before starting, ensure you have the following:

  • Access to your DNS settings.
  • Access to your Neostore configuration files.

Step-by-Step Configuration

  1. Request Authorization:

    Contact Neostore support to request authorization for sending emails on your behalf. Provide your desired subdomain for security reasons. For example, use registration.yourdomain.com instead of yourdomain.com.

  2. Update DNS Settings:

    Update your DNS settings with the following records to authorize Neostore’s SendGrid account to send emails on your behalf. Below is an example configuration:

    type     | key                                       | value                                      | remarks
    ------------------------------------------------------------------------------------------------------
    CNAME    | em5094.registration.yourdomain.com        | u22547844.wl095.sendgrid.net               | used by SendGrid for domain validation
    CNAME    | neo._domainkey.registration.yourdomain.com| neo.domainkey.u22547844.wl095.sendgrid.net | used by SendGrid for DKIM authentication
    CNAME    | neo2._domainkey.registration.yourdomain.com| neo2.domainkey.u22547844.wl095.sendgrid.net| used by SendGrid for DKIM authentication
    TXT      | _dmarc.registration.yourdomain.com        | v=DMARC1; p=none;                          | DMARC configuration
    
  3. Update Neostore Configuration:

    Once DNS settings are updated, configure Neostore to use the provided subdomain for sending emails. Open your Neostore configuration file and set the email provider section as follows:

    provider:
      type: sendgrid
      apiKey: # Neostore's SendGrid API key will be used internally
      from:
        email: no-reply@registration.yourdomain.com
        name: yourcompany
    resources:
      - /locales/emails/
    
  4. Save and Test Configuration:

    Save your changes and test the email configuration by sending a test email from Neostore’s admin panel or test endpoint.

  5. Example Email Template:

    Place your email templates in the specified resources directory (/locales/emails/). Example structure:

    • /locales/emails/welcome_email.html
    • /locales/emails/reset_password.html

Security Note

For security reasons, authorizing Neostore to send emails only from a subdomain limits potential misuse. Ensure your main domain email sending is not affected.

Article 2: Using Your Own SendGrid Account

Configuring Neostore to Use Your Own SendGrid Account

This guide explains how to configure Neostore to use your own SendGrid account for sending emails.

Prerequisites

Before starting, ensure you have:

  • A SendGrid account.
  • An API key from SendGrid.
  • Access to your Neostore configuration files.

Step-by-Step Configuration

  1. Obtain SendGrid API Key:

    • Log in to your SendGrid account.
    • Navigate to Settings > API Keys.
    • Click Create API Key.
    • Provide a name for your API key and select the appropriate permissions.
    • Click Create & View and copy the API key.
  2. Update Neostore Configuration:

    Open your Neostore configuration file and update the email provider section with your SendGrid account details:

    provider:
      type: sendgrid
      apiKey: YOUR_SENDGRID_API_KEY
      from:
        email: contact@yourdomain.com
        name: yourcompany
    resources:
      - /locales/emails/
    

    Explanation:

    • type: Specifies the email provider. Set this to sendgrid.
    • apiKey: Your SendGrid API key.
    • from:
      • email: The email address that will appear as the sender.
      • name: The name that will appear as the sender.
    • resources: Path to the email templates used by Neostore.
  3. Save and Test Configuration:

    Save your changes and test the email configuration by sending a test email from Neostore’s admin panel or test endpoint.

  4. Example Email Template:

    Place your email templates in the specified resources directory (/locales/emails/). Example structure:

    • /locales/emails/welcome_email.html
    • /locales/emails/reset_password.html

Troubleshooting

If you encounter issues, consider the following steps:

  • Check API Key: Ensure the API key is correct and has the necessary permissions.
  • Logs: Review Neostore logs for any error messages related to email sending.
  • SendGrid Dashboard: Check the SendGrid dashboard for email activity and error messages.

Security Note

For security reasons, do not hard-code your API key directly into the configuration file in a production environment. Use environment variables or a secure secrets management service.

By following these steps, you can configure Neostore to send emails using either Neostore’s SendGrid account or your own SendGrid account effectively. For further assistance, refer to the Neostore and SendGrid documentation or contact their support teams.

Access denied
Access denied