mail function in Magento

In this article we talk about here when mail not send by Magento store.
So you can check by mail function that is server is working with e-mail.

First off all below code paste in new file like mail.php and upload in root directory.  

Here is code....


<?php
 $mageFilename = 'app/Mage.php';
 require_once $mageFilename;
 Mage::setIsDeveloperMode(true);
 ini_set('display_errors', 1);
 umask(0);
 Mage::app('admin');
   
 set_time_limit(0);
 ini_set('memory_limit','1024M');

 $to = "yourmail@gmail.com";// give your email ID for check mail
 $subject = "This is subject";
 $message = "This is simple text message.";
 $header = "From:abc@somedomain.com";
 $retval = mail ($to,$subject,$message,$header);
 if( $retval == true )  
 {
   echo "Message sent successfully...";
 }
 else
 {
   echo "Message could not be sent...";
 }
?>
After upload mail.php file run....
ex: yourdomain.com/mail.php


and check after your gmail ID. If mail come then not a server problem.

Labels: