3

My code is:

<?php
require_once "app/Mage.php";
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'frontend'));



// This is the template name from your etc/config.xml 
$template_id = 'exceptionCode';

// Who were sending to...
$email_to = 'teste@gmail.com';
$customer_name   = 'teste';

// Load our template by template_id
$email_template  = Mage::getModel('core/email_template')->loadDefault($template_id);

// Here is where we can define custom variables to go in our email template!
$email_template_variables = array(
    'customer_name' => $customerName
    // Other variables for our email template.
);

// I'm using the Store Name as sender name here.
$sender_name = Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_STORE_STORE_NAME);
// I'm using the general store contact here as the sender email.
$sender_email = Mage::getStoreConfig('trans_email/ident_general/email');
$email_template->setSenderName($sender_name);
$email_template->setSenderEmail($sender_email); 

//Send the email!
$email_template->send($email_to, $customer_name, $email_template_variables);

?>

Then i run in root dir and empty blank page shows nothing and i not recieve the mail. Why? I follow the steps https://www.ashsmith.io/2014/08/28/custom-transactional-emails-in-magento/ and doesnt work. Thanks

closed as too broad by Keyur Shah, 7ochem, Amit Bera, Marius May 18 '15 at 11:16

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

The blank page based on what you are describing sounds to be simply that your not rendering any actual page therefore getting no output.

As to not sending out e-mail, it is likely a result of not having a mail server installed on localhost.

Try installing sendmail/postfix or some other mail service on the server. We use http://mailcatcher.me/ to be able to catch e-mails from being sent out in development environments but see the results instead in your web browser as it would be received by a mail client. This is a good way to prevent clients from getting notifications as a result of tests then being unable to find corresponding orders etc.

  • hi, i have this module instaled and configured for use. magentocommerce.com/magento-connect/… In her, the shows in "run test" is: SMTP Pro Self Test Results Sending test email to your contact form address: hello@example.com from: owner@example.com. Test email was sent successfully. Default templates exist. Email communications are enabled. Required database tables exist. Testing complete, support@aschroder.com for support. everthing ok, but in PHP dont send nothing – Matheus Silva Itep May 19 '15 at 4:27

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