1

Some background and my challenge:

Background

I am using Magento 2.x using a virtual machine set-up which runs on Ubuntu 16.04

Challenge

My goal is to be able to test emails sent to me from the Magento application. In an ideal situation, I would not use an extension or third-party service (although a third-party SMTP server on the linux box could work).

To achieve my goal, I need to be able to register as a customer in the Magento application with any email address (fake or real) and have the email sent to the same external email address, no matter what.

What I've done so far

  1. I've installed postfix
  2. I've installed Magento using luma.com as the domain (and set up my hosts file accordingly on my host machine, etc.)
  3. I've created a linux user account called "contact"
  4. I've configured inet_interfaces in /etc/postfix/main.cf as loopback-only
  5. I've set mydestination to $myhostname, localhost.$mydomain, $mydomain
  6. I've configured Magento to send its store emails from contact@luma.com
  7. I've set up an aliases file as the following:

    postmaster:    root
    root:          contact
    contact:       me@gmail.com
    

Then I ran newaliases As far as I recall, email sends fine with this setup. Hooray!

Next, the catch-all part. For this, I've tried loads of things, and none seem to work. From the reading I've done, I've tried the following:

In /etc/postfix/main.cf, I added the following:

    virtual_alias_domains = luma.com
    virtual_alias_maps = hash:/etc/postfix/virtual

Next, in /etc/postfix/virtual, I encountered my first problem. As far as I understand from the reading I've done, I'm supposed to use something like:

    @example.com   contact

This step apparently ensures that any email sent via postfix (e.g. from the Magento application) which uses an @example.com email address would be routed to the contact linux user I created above. Then, my thinking was that the system would use the alias I set up to ultimately send out that email from contact@luma.com (via the settings in Magento) through to the external address I set up in the aliases file. This approach would theoretically allow a user to register for an account with Magento using, say, joe@example.com, and then send the associated Welcome email to my external email address.

The issue with this is that I need the system to do this for any email, not just for emails ending in @example.com

Just for sake of completeness, I'll say that before asking this question, I was most recently researching how to achieve this part of the challenge using pcre tables. I've also tried configuring something using luser_relay, but both of these things are over my head at this point, so I'm lost.

My hope is that someone can offer some guidance as to whether I'm on the right path, where I may have missed something, and ultimately, offer some advice on whether my challenge can be solved and how I might go about solving it.

NOTE: I originally posted this over at stackoverflow but was advised to post it here. Hopefully this is acceptable. Thanks for reading.

Steve K
  • 111
  • 1

0 Answers0