1

In Magento 1.x you could send a transactional email as follows.

$identity = Mage::getStoreConfig('section/group/identity',Mage::app()->getStore());

            $identityName = Mage::getStoreConfig('trans_email/ident_'.$identity.'/name');
            $identityEmail = Mage::getStoreConfig('trans_email/ident_'.$identity.'/email');

            $emailTemplate = Mage::getStoreConfig('section/group/template',Mage::app()->getStore());


            $sender = Array('name' => $identityName,
                            'email' => $identityEmail);


            $store = Mage::app()->getStore();

            $vars = Array('subscriber_email' => $email);

            // Translation        
            $translate  = Mage::getSingleton('core/translate');

            // Send email
            try {
            $transactionalEmail = Mage::getModel('core/email_template');
            $transactionalEmail->sendTransactional($emailTemplate,
                                                                     $sender,
                                                                     $email,
                                                                     $vars,
                                                                     $store->getId());

            } catch (Exception $e) { 

            }




            // Translate        
            $translate->setTranslateInline(true);



            }

How would I go about forming a class to accomplish the same in Magento 2.x? I've tried going over the unit test controllers inside the Magento code sample but I am not seeing how it all ties together.

Browse other questions tagged or ask your own question.