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 = 'test@gmail.com';
    $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


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);
|improve this answer|||||

Try to allow your variables :

System -> Permissions -> Variables -> Add new Variable
|improve this answer|||||

Your Answer

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

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