Magento News
Magento – sending email programmatically – some unanswered questions
Hello,
I asked some questions a while back about sending emails programmatically from a custom module (Sending e-mail programmatically in Magento is failing), and although I got this working, I don’t think I have it working the way it should be.
First I overrode the getMail() method in Mage_Core_Model_Email_Template as outlined in this post: http://www.magentocommerce.com/boards/viewthread/1073/P30/, but that raises a few questions:
Q1: In my overriding getMail() method, I had to specify a username and password to log on to my smtp server. Can someone please tell me why this is not specifiable in the Magento Admin panel? As it isn’t, I’ll have to gather that information in my custom module’s config so that I have a user name and password to use when sending the e-mail, and that just seems plain wrong to me.
Q2: How should I load the template (the name/id of which will be a configuration field in my custom module). I got loadByCode to work:
$emailTemplate = Mage::getModel(‘core/email_template’)->loadByCode(‘Bob’);
but I see some people doing:
$emailTemplate = Mage::getModel(‘core/email_template’)->loadDefault(‘no matter what goes here emailTemplate is not set’);
Q3: Is there a method I can call to get all email templates so that I can offer a selection of them in my custom module configuration?
Thanks.
Magento – sending email programmatically – some unanswered questions
Possibly Related Posts:
- Database query different results
- Menu highlight in magento under admin
- magento disable a banner on certain category pages or have a banner with multiple links
- Magento, using ACL for frontend. Possible?
- Magento IE-7 Fix In Windows XP
RSS Feed