Magento Forum

   
Manually send email using template? 
 
Eric1285
Jr. Member
 
Total Posts:  19
Joined:  2008-12-11
 

Is it possible to manually send an email using one of the transactional email templates? I’m using the Customer Activation extension to manually activate customers and would like to send an email after they have been activated. Since this is an extension there doesn’t seem to be any easy way to automate the process, so the emails must be sent manually. However, I can’t find a way to use any of the email templates to do this which means I have to fill in the fields for each email manually.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Eric1285
Jr. Member
 
Total Posts:  19
Joined:  2008-12-11
 

Anyone have an idea of how to do this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
HyperBallad
Member
 
Avatar
Total Posts:  57
Joined:  2008-06-27
Montreal, QC
 

Same thing… I really need to send an confirmation to customers once they are activated.
I know that this function is on the roadmap of this extension’s developer. But it does not seems to come....

 
Magento Community Magento Community
Magento Community
Magento Community
 
Eric1285
Jr. Member
 
Total Posts:  19
Joined:  2008-12-11
 

Bump.

I still have not figured out how to do this. Hasn’t been a big deal yet because I haven’t finalized the website, but that’s coming up soon and I’d like to know how to get this working.

 
Magento Community Magento Community
Magento Community
Magento Community
 
HyperBallad
Member
 
Avatar
Total Posts:  57
Joined:  2008-06-27
Montreal, QC
 

Same here. I have not found a way to do this, at least a “send confirmation” button on the customer profile would be fantastic.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Eric1285
Jr. Member
 
Total Posts:  19
Joined:  2008-12-11
 

Still haven’t been able to figure this one out.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sammeer
Jr. Member
 
Total Posts:  1
Joined:  2012-10-03
 

<?php
                $customer = Mage::getModel('customer/customer')->load(2); //suppose the customer whose data to be fetched is 2
                if(!empty($customer))
                {
                    $mailTemplate = Mage::getModel('core/email_template');
                    /* @var $mailTemplate Mage_Core_Model_Email_Template */
             
                    $translate  = Mage::getSingleton('core/translate');
                     
                    $templateId = 3; //template for sending customer data
                    $template_collection =  $mailTemplate->load($templateId);                               
                    $template_data = $template_collection->getData();
                    if(!empty($template_data))
                    {
                        $templateId = $template_data['template_id'];
                        $mailSubject = $template_data['template_subject'];                         
                         
                        //fetch sender data from Adminend > System > Configuration > Store Email Addresses > General Contact
                        $from_email = Mage::getStoreConfig('trans_email/ident_general/email'); //fetch sender email
                        $from_name = Mage::getStoreConfig('trans_email/ident_general/name'); //fetch sender name
                 
                        $sender = array('name'  => $from_name,
                                        'email' => $from_email);                                
                         
                        $vars = array('customer'=>$customer); //for replacing the variables in email with data                  
                        /*This is optional*/
                        $storeId = Mage::app()->getStore()->getId();
                        $model = $mailTemplate->setReplyTo($sender['email'])->setTemplateSubject($mailSubject);
                        $email = $customer->getEmail();
                        $name = $customer->getName();                                           
                        $model->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);                    
                        if (!$mailTemplate->getSentSuccess()) {
                                throw new Exception();
                        }
                        $translate->setTranslateInline(true);
                    }
                }
?>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top