1

I have created an email with a coupon for customers. It is now in the list of the transactional email in the admin as a new layout.

Is there a way to send that transactional email manually to those customers I would like to send?

Or do transactional emails need to be sent only in a programmatic way or with an extension?

  • 1
    Afaik there is no way to send a transactionnal email manually (besides the one on the order). I think you need to develop a little something in a controller so as to be able to send the email. Perhaps a mailing extension can help you with that. – Julien Lachal Apr 20 '17 at 9:17
  • Developing a controller will I be able to select to which customer to send that email? – bobrock4 Apr 20 '17 at 9:27
  • If you can have a multiselect somewhere, or run a query returning a list of customer emails, yes. – Julien Lachal Apr 20 '17 at 9:40
1

Loads the html file named 'custom_email_template1.html' from

app/locale/en_US/template/email/activecodeline_custom_email1.html

$emailTemplate  = Mage::getModel('core/email_template')
                        ->loadDefault('custom_email_template1');                                    

//Create an array of variables to assign to template
$emailTemplateVariables = array();
$emailTemplateVariables['myvar1'] = 'Branko';
$emailTemplateVariables['myvar2'] = 'Ajzele';
$emailTemplateVariables['myvar3'] = 'ActiveCodeline';

/**
 * The best part 🙂
 * Opens the activecodeline_custom_email1.html, throws in the variable array
 * and returns the 'parsed' content that you can use as body of email
 */
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);

/*
 * Or you can send the email directly,
 * note getProcessedTemplate is called inside send()
 */
$emailTemplate->send('john@someemail.com','John Doe', $emailTemplateVariables);

you need to add an entry to your config.xml

...

    <label>ActiveCodeline custom email module</label>
                    activecodeline_custom_email1.html
                    html

...

app/locale/en_US/template/email/activecodeline_custom_email1.html

<!--@subject ActiveCodeline custom email module @-->

Hi there {{var myvar1}} {{var myvar2}} from {{var myvar3}}. This is just some example template to test custom email module...

Source : http://inchoo.net/magento/magento-custom-emails/

  • Do I create in this way an html email (activecodeline_custom_email1.html) to be sent to john@someemail.com? – bobrock4 Apr 20 '17 at 12:54
  • Yes, look the source link – PЯINCƏ Apr 20 '17 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.