How to Connect MailJet on Magento 2?
Email marketing is one of the most reliable marketing strategies you can use for your Magento 2 e-commerce store. It can help you engage with your customers and increase your sales. Choosing the right tool for email marketing is crucial as there seem to be a lot of them out there.
But don’t worry, we got you covered. We have found the best email marketing tool for Magento 2.
Mailjet is one of the leading email automation tools for Magento users. With Mailjet for Magento, sending emails is now as easy as sending a tweet. Your customer’s feedback will never escape your sight with Mailjet’s advanced reporting features. If you’re a Magento customer, then you need Mailjet!
What can you do with Mailjet?
Get into Customer’s Inbox
Most promotional emails end up in either the Promotional folder or Spam box, but not with Mailjet; Mailjet helps you get right into your customer’s inbox. Using Mailjet’s SMTP relay, you can improve your deliverability.
Identify and target prospects
Target your high potential customers at the right time with a personalized email.
Drag-and-drop newsletter editor
Mailjet offers 30+ newsletter templates to help you create marketing campaigns within minutes.
Send, track and optimize your email strategy using Mailjet.
Install and Configure Mailjet Extension
How to Install Mailjet Extension?
- Back up your database- just to make sure that no undesired changes would occur
- Set up Cron job. Refer to this document to set it up
- Log in to SSH and go to your store root directory
- Enable Maintenance mode using the following command
php bin/magento maintenance:enable
- Upload your module’s file with the composer or via FTP
Steps to upload via FTP:
- Go to Magento store purchases & download your module archive
- Use Filezilla or another FTP client & Connect to your hosting server
- Go to your_store_root_directory/app/code
- Create a folder “Mailjet” and enter it
- In this folder, create a new folder, “Mailjet” and enter it
- Extract the files on your PC
- Upload the module’s files to the opened directory on the FTP client
- Go to your CLI and download the Mailjet library using this command composer require mailjet/mailjet-apiv3-php
Steps to upload with composer:
- In your Magento project, update the composer.json file with the name of the extension
- Add the extension’s name and version to your composer.json file and download the required package
composer require mailjet/mailjet-magento2–no-update
composer update mailjet/mailjet-magento2
- Enter your authentication keys. Your public key will be your username; your private key will be your password:
- To get your authentication keys, navigate to Magento Marketplace > Your name > My Profile
- In the Marketplace tab, click on “Access Keys”
- Create a New Access Key if you don’t have Access Keys
- Enter a name for the keys (e.g., name of developer) and click OK
- Click to copy your new public and private keys. They are now associated with your account. Save this information or keep the tab open when working with your Magento project. Use your Public key as the username and the Private key as a password
- Wait until Composer finishes updating your project dependencies and make sure there aren’t any errors
- Verify extension
Run the following command to verify that the extension is installed properly
Php bin/magento module:status Mailjet_Mailjet
If the extension is disabled by default, you will see this message.
- Enable the extension
- Enable it and clear static view files
php bin/magento module:enable Mailjet_Mailjet–clear-static-content
- Register the extension
php bin/magento setup:upgrade
- Recompile your Magento project:
You may receive this message in Production mode: “Please rerun Magento compile command”. In Developer mode, Magento does not prompt you to run the compile command.
php bin/magento setup:di:compile
- Verify if your extension is enabled or not
php bin/magento module: status Mailjet_Mailjet
If you see this output, your extension is enabled.
- Now, clean the cache.
php bin/magento cache:clean
- Disable maintenance mode
php bin/magento maintenance:disable
- In Admin, configure the extension as per your requirement, Admin panel > Stores > Configuration > Mailjet
You will need a Mailjet account to set your API settings, if you don’t have any, click here to create a Mailjet account.
The Mailjet extension has been successfully installed!
The next step is to configure Mailjet Extension and to configure it, return to your Magento Admin Page.
How to Configure Mailjet Settings?
- In the Magento 2 Admin Page, navigate to “Mailjet” → “Configuration”.
- You’ll see a Mailjet section in the left side menu; click on “Account Configuration” under the “Mailjet” section
- Now enable the plugin and add your Mailjet API key and Secret Key.
What do these options do?
- Plugin Enabled– Set it to “Yes”. By doing so, you enable Mailjet to send all emails from your Magento Environment. You can access real-time statistics, order status, ROI on campaigns, and more with Mailjet’s SMTP relay.
- API settings– Enter your Mailjet API and secret key to link Mailjet with your Magento account. Find your API and Secret Keys on the API Key Management Page
- Subscribed Sync enabled– “Yes” means Magento 2 subscriber data is synced with Mailjet and vice versa
- Unsub event enabled – Sync unsubscribed contacts automatically from Mailjet to Magento 2.
- SMTP enabled – When it’s enabled, Magento 2 transactional emails are delivered through Mailjet SMTP.
Click on “Save Config” once you’ve entered all the information.
How to configure the sender address for automatic emails?
To choose the sender address, choose General under the configuration section and navigate to “Store Email Addresses”.
You can select the email and sender name from the options available in this section.
You will have to verify the General Contact email in Mailjet in order to use it. General Contact email will be used by Magento to send automatic emails.
Please visit the Sendor Domains & addresses section of your Mailjet account to verify the General Contact email.
How to track events?
If you want to track events automatically in Magento, use the Endpoint URL displayed at the top of the Mailjet “ Settings” Section.
First copy the displayed link, then navigate to the “Event Tracking” section in your Mailjet account.
Let’s take the example of the “unsub” event here. When a customer unsubscribes from your newsletter, the information will be pushed to Magento, and the customer’s profile will be updated automatically.
Simply follow these steps to automate the whole process.
- Tick the checkbox; in our case, tick the checkbox next to “Unsub”.
- Paste the Endpoint URL
- Click on “Send” to test the URL.
- You will see a message OK, Code 200 if the test is successful
- Click “Save”
That’s it. You have configured your Mailjet Extension!
Now, you can automate emails on your Magento store.