We want to create one php file. When we run it from front side then send mail. We don't want to create module. We also wand to use magento 1.9 default functionality.

Any one help me for create it.

2 Answers 2


Create send.php file into root folder.

    require_once('app/Mage.php'); //Path to Magento
            $html=" Write your Content Here

            $mail = Mage::getModel('core/email');
            $mail->setToName('Your Name');
            $mail->setToEmail('[email protected]');
            $mail->setBody('Mail Text / Mail Content');
            $mail->setSubject('Mail Subject');
            $mail->setFromEmail('Sender Mail Id');
            $mail->setFromName("Msg to Show on Subject");
            $mail->setType('html');// You can use Html or text as Mail format
            $mail->setBodyHTML($html);  // your content or message

                echo 'Your request has been sent';
            } else {
               echo 'Unable to send.';
  • It's working as per my requirement. Thanks
    – Anil
    Jun 25, 2019 at 10:29
  • for me it is redirecting to search page. Aug 24, 2021 at 11:14

You can add this script to your custom .php file and you can run it in browser.

require_once('app/Mage.php'); //Path to Magento

$msg = "your message";
mail("[email protected]","My subject",$msg);

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.