Skip to main content
added 69 characters in body
Source Link
Dominic Pixie
  • 7.6k
  • 4
  • 20
  • 59

I've seen some complex solutions to this. But in m1 it can actually be done really simply.

$mail = Mage::getModel('core/email')
    ->setToName('Xigen')
    ->setToEmail('[email protected]')
    ->setSubject('Problem')
    ->setBody('<p>markup<p>')
    ->setFromEmail('[email protected]')
    ->setFromName('Customer services\'s')
    ->setType('html');
try {
    $mail->send();
} catch (Exception $e) {
    Mage::throwException($e);
}

I think sometimes simple is best. Clean and easy to read.

This approach means you cant use transactional email templates though. These are the CMS type entries with the smart tags (or whatever magento call them).

Method 3 for the win!

Method 1 gives you the above abilities.

I've seen some complex solutions to this. But in m1 it can actually be done really simply.

$mail = Mage::getModel('core/email')
    ->setToName('Xigen')
    ->setToEmail('[email protected]')
    ->setSubject('Problem')
    ->setBody('<p>markup<p>')
    ->setFromEmail('[email protected]')
    ->setFromName('Customer services\'s')
    ->setType('html');
try {
    $mail->send();
} catch (Exception $e) {
    Mage::throwException($e);
}

I think sometimes simple is best. Clean and easy to read.

This approach means you cant use transactional email templates though. These are the CMS type entries with the smart tags (or whatever magento call them)

I've seen some complex solutions to this. But in m1 it can actually be done really simply.

$mail = Mage::getModel('core/email')
    ->setToName('Xigen')
    ->setToEmail('[email protected]')
    ->setSubject('Problem')
    ->setBody('<p>markup<p>')
    ->setFromEmail('[email protected]')
    ->setFromName('Customer services\'s')
    ->setType('html');
try {
    $mail->send();
} catch (Exception $e) {
    Mage::throwException($e);
}

I think sometimes simple is best. Clean and easy to read.

This approach means you cant use transactional email templates though. These are the CMS type entries with the smart tags (or whatever magento call them).

Method 3 for the win!

Method 1 gives you the above abilities.

Source Link
Dominic Pixie
  • 7.6k
  • 4
  • 20
  • 59

I've seen some complex solutions to this. But in m1 it can actually be done really simply.

$mail = Mage::getModel('core/email')
    ->setToName('Xigen')
    ->setToEmail('[email protected]')
    ->setSubject('Problem')
    ->setBody('<p>markup<p>')
    ->setFromEmail('[email protected]')
    ->setFromName('Customer services\'s')
    ->setType('html');
try {
    $mail->send();
} catch (Exception $e) {
    Mage::throwException($e);
}

I think sometimes simple is best. Clean and easy to read.

This approach means you cant use transactional email templates though. These are the CMS type entries with the smart tags (or whatever magento call them)