I followed the tutorial below. I'm trying to send an email to the administrator when a new user signs up. The email is sending it's just sending when I hit the page not after filling out the information. How can I only have it send after they fill out the registration form??


In my config.xml

  <custom_email_template1 module="SampleModule1">
    <label>ActiveCodeline custom email module</label>

In App/local/en_us/template/email/activecodeline_custom_email1.html

<h1>ActiveCodeline custom email example by Branko Ajzele</h1>
<p>Hi there {{var myvar1}} {{var myvar2}} from {{var myvar3}}. This is just some example template to test custom email module.</p>

and lastly in my register.phtml I put this at the bottom.


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

    //Getting the Store E-Mail Sender Name.
    $senderName = 'billa';

    //Getting the Store General E-Mail.
    $senderEmail = 'email@email.com';

    //Variables for Confirmation Mail.
    $emailTemplateVariables = array();
    $emailTemplateVariables['myvar1'] = 'Email Address';
    $emailTemplateVariables['myvar2'] = 'Ajzele';
    $emailTemplateVariables['myvar3'] = 'ActiveCodeline';

    //Appending the Custom Variables to Template.
    $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);

    //Sending E-Mail to Customers.
    $mail = Mage::getModel('core/email')
    ->setSubject('Subject : A New Customer Has Signed Up')
    ->setFromName('New Customer Notification')
    //Confimation E-Mail Send
    catch(Exception $error)
    return false;
  • are you need to send email to admin after fill up all form fields or only First Name, Last Name & Email?
    – Abdul
    Dec 24 '15 at 4:28
  • @Abdul I want to eventually include all fields but I was going to start by trying to get it to work with the basics first. Dec 24 '15 at 14:08

Your Answer

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

Browse other questions tagged or ask your own question.