0

How to resend the customer confirmation email (Register) through admin panel? Is there any options for resending?. Please help

2 Answers 2

2

There is no default option in magento to resend a account creation email. But you can achieve this by:

Rewrite the block classMage_Adminhtml_Block_Customer_Edit and add a new button in the constructor:

if ($this->getCustomerId()) {
    $this->_addButton('resendemail', array(
        'label' => Mage::helper('customer')->__('Resend Confimation Email'),
        'onclick' => 'setLocation(\'' . $this->getUrl('yourmodule/customer/resendEmail', array('customer_id' => $this->getCustomerId())) . '\')',
    ), 0);
}

Create your own custom controller action:

public function resendEmailAction() {
    $customerId = $this->getRequest()->getParam('customer_id', false);
    if ($customerId) {
        $customer = Mage::getModel('customer/customer')->load($customerId);

        if ($customer->isConfirmationRequired()) {
            $customer->sendNewAccountEmail('confirmation', '', $customer->getStoreId());
        } else {
            $customer->sendNewAccountEmail('registered', '', $customer->getStoreId());
        }
    }
    $this->_redirect('*/customer');
}
6
  • Hi, I have add the above code and confirmation email send successfully. But while click on the confirmation button on email, show as "Bad request"
    – Rat
    Oct 12, 2016 at 6:01
  • What is the url of that button?
    – Nidheesh
    Oct 12, 2016 at 6:15
  • This is url confirmation link button. domain.com/customer/account/confirm/?back_url=&id=176
    – Rat
    Oct 12, 2016 at 6:19
  • registered will use the email template which has a confirmation key in it, and your configuration (System >> Configuration >> Customer >> Require Emails Confirmation = Yes for this.
    – Nidheesh
    Oct 12, 2016 at 6:37
  • try the updated answer
    – Nidheesh
    Oct 12, 2016 at 6:40
0
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('memory_limit', '5G');
error_reporting(E_ALL);

use Magento\Framework\App\Bootstrap;
use Magento\Framework\Exception\MailException;

require 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);

$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');

$id = 3;
$customer = $objectManager->create('\Magento\Customer\Api\CustomerRepositoryInterface')->getById($id);
$confirmation = $objectManager->create('\Magento\Customer\Model\EmailNotificationInterface');
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$email = $customer->getEmail();
$accountMangement = $objectManager->get('\Magento\Customer\Model\AccountManagement');
$accountMangement->resendConfirmation($email,1);
echo "done";

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.