This is my email sending code

if (isset($_POST['send'])) {
    $templateId = 9;
    $sendername = 'Call To Order';
    $senderemail = $_POST['email'];
    $sendermobile = $_POST['mobile'];
    $sender = Array('name' => $sendername,
        'email' => $senderemail);
    $toEmail = '[email protected]';
    $vars = Array();
    $vars = Array('email' => $senderemail, 'mobile' => $sendermobile);
    $storeId = Mage::app()->getStore()->getId();
    $translate = Mage::getSingleton('core/translate');
            ->sendTransactional($templateId, $sender, $toEmail, $vars, $storeId);

this is my transnational email template

Email: {{var email}}

Mobile: {{var mobile}}

And I am getting this into my email

enter image description here

2 Answers 2


Below definition of sendTransactional method :

 * Send transactional email to recipient
 * @param   int $templateId
 * @param   string|array $sender sneder informatio, can be declared as part of config path
 * @param   string $email recipient email
 * @param   string $name recipient name
 * @param   array $vars varianles which can be used in template
 * @param   int|null $storeId
 * @return  Mage_Core_Model_Email_Template
public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)

As you can see $vars is fifth parameter.

You code should looks like that :

        ->sendTransactional($templateId, $sender, $toEmail, 'recipient name' $vars, $storeId);

Try to allow your variables :

System -> Permissions -> Variables -> Add new Variable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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