Skip to main content

SMTP settings for Magento / Magento Send Email using smtp

If you want to send emails with Magento you need to configure it to use an SMTP server – that is, the outgoing server that takes care of delivering your messages.

magento to use SMTP instead of the usual mail function, you need to take the below steps.
- Login to magento admin and go to. System->Configuration->Advanced->System->Mail Sending Settings
- Now here set the host value to your smtp host name like
mail.domain.com
- And then the default port is 25.
- Now you need to change magento file. Do not edit the core file as you will loose your change in an upgrade.
- So copy this file app/code/core/Mage/core/Model/Email/Template.php in to your local, by creating the same folder structure.
- Enable that module.
- Then in Template.php you will have to change the getMail() function as below.
public function getMail()
    {
        if (is_null($this->_mail)) {
            /* changes begin */
           $my_smtp_host = Mage::getStoreConfig('system/smtp/host');
           $my_smtp_port = Mage::getStoreConfig('system/smtp/port');
           $config = array(
                    'port' => $my_smtp_port,
                    'auth' => 'login',
                    'username' => 'email@domain.com',
                    'password' => 'yourpassword'
                );
            $transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
            Zend_Mail::setDefaultTransport($transport);
            /* Changes End */
            $this->_mail = new Zend_Mail('utf-8');
        }
        return $this->_mail;
    }
- After this clear your cache.
- Now magento will be able to send emails for you.

Comments

Popular posts from this blog

How to Call Newsletter in footer in Magento

To show Newsletter in footer go to app/design/frontend/default/YourTheme/layout/newsletter.xml and add the following lines in default < reference name = "footer" > < block type = "newsletter/subscribe" name = "footer.newsletter"   template = "newsletter/subscribe.phtml" /> </ reference > and add the following line in app/design/frontend/default/YourTheme/template/page/html/footer.phtml <?php echo $this -> getChildHtml ( 'footer.newsletter' ) ; ?>

Smooth Page Scroll Script

< script > $(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')  && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); }); </ script >