Expertwebadvisor

  • Magento 2
  • PHP
  • WordPress
  • MySQL
  • SEO
  • Java Script
  • Others
  • Top 10’s

Sending Email By Using Zend_Mail() In Magento

By Expertwebadvisor | Last Updated: August 26, 2013 | In: Magento


Sometimes we wants to create a form and want to send the form information through the email in Magento. Here in this post I am trying to describe how we can send an email by using the Zend_Mail()?. It is very easy and there is predefined function in Magento to send the information through emails
Sending Email By Using Zend_Mail() In Magento

Below is the code :

<?php
public function sendEmail()
{
    $fromEmail = "from@abc.com"; // sender email address
    $fromName = "EWA"; // sender name
 
    $toEmail = "to@abc.com"; // recipient email address
    $toName = "EWA1"; // recipient name
 
    $body = "This is Test Email!"; // body text
    $subject = "Test Subject1"; // subject text
 
    $mail = new Zend_Mail();       
 
    $mail->setBodyText($body);
 
    $mail->setFrom($fromEmail, $fromName);
 
    $mail->addTo($toEmail, $toName);
 
    $mail->setSubject($subject);
 
    try {
        $mail->send();
    }
    catch(Exception $ex) {
        Mage::getSingleton('core/session')
            ->addError(Mage::helper('yourmodulename') //Your custom module name
            ->__('Unable to send email.'));
    }
}

?>

Read More Regarding the PHP Email Click Here

Hope this would be helpfull, Keep reading and enjoy the Magento coding.

Tags:Custom Email In Magento,Magento,Send Email In Magento


Related Posts

  • Enable or Disable Demo Store Notices In Magento Enable or Disable Demo Store Notices In Magento
  • Run Magento Session Into An External Site Run Magento Session Into An External Site
  • Display The Custom Products Attributes On the Frontend Product Listing as Well as on the Product Description Page In Magento Display The Custom Products Attributes On the Frontend Product Listing as Well as on the Product Description Page In Magento
  • Magento 1.3.x, 1.4.x, 1.5.x, 1.6.x, 1.7.x, 1.8.x and 1.9.x upgrade process by using the SSH. Magento 1.3.x, 1.4.x, 1.5.x, 1.6.x, 1.7.x, 1.8.x and 1.9.x upgrade process by using the SSH.
  • Be Social, Share Us Here !!

  • Looking For Something !!

  • Popular Categories !!

    • Magento 2 Guide and Tutorials
    • Home Loan EMI Calculator
    • Car Loan EMI Calculator
    • Personal Loan EMI Calculator
    • Magento Guide & Tutorials
    • PHP Tutorials
    • WordPress Tutorials
    • SEO Tutorials
    • MySQL Guide
    • Opencart Tutorials
    • Linux/Ubuntu Guide
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Facebook
  • Twitter
  • DMCA.com Protection Status

Recent Posts

  • PHP array_​diff_​key Function
  • PHP array_​diff_​assoc Function
  • PHP array_​diff Function
  • PHP array_​count_​values Function
  • PHP array_​combine Function

Welcome to my Blog

Thanks for visiting my Blog, I have started this blog before 8 years ago and sharing my own experience, problem and solutions while working on the different type of projects. Enjoy the reading and don't forget to Facebook likes, Tweets or G+. You can also write me expertwebadvisor@gmail.com
© 2013 - 2026 Powered By
Top