Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 905249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:11:11+00:00 2026-05-15T16:11:11+00:00

The newsletter subscription module in Magento has only one field (email) by default. After

  • 0

The newsletter subscription module in Magento has only one field (email) by default. After I add an extra field to the form (say country), how can I get the form data to show up in the Magento back-end and be sent as an email to a preset recipient? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:11:12+00:00Added an answer on May 15, 2026 at 4:11 pm

    There are a few things that you need to take care of to make this work:

    1. Add a new column for your data to the appropriate database table
    2. Make sure that Magento saves your new field to the database
    3. Present the data in the admin backend
    4. Record the data when you get a new newsletter subscription

    Here’s how you can do all those things:

    Ad. 1)

    Using phpMyAdmin, MySQL command line, or whatever is your preferred DB manipulation method, add a new column "country" as, say, varchar(100) to the newsletter_subscriber table.

    Ad. 2)

    Magento will automatically give you access to the new field through the getCountry() and setCountry() methods on the Mage_Newsletter_Model_Subscriber object. The only thing it won’t do is save your field back to the DB after it has been changed with code somewhere in the system. To get it saved you need to modify _prepareSave(Mage_Newsletter_Model_Subscriber $subscriber) function found in Mage_Newsletter_Model_Mysql4_Subscriber (app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber.php). Be sure to make a local copy of the file first and not modify the core file. Here’s what you need to add:

    protected function _prepareSave(Mage_Newsletter_Model_Subscriber $subscriber)
    {
        $data = array();
        $data['customer_id'] = $subscriber->getCustomerId();
        $data['store_id'] = $subscriber->getStoreId()?$subscriber->getStoreId():0;
        $data['subscriber_status'] = $subscriber->getStatus();
        $data['subscriber_email']  = $subscriber->getEmail();
        $data['subscriber_confirm_code'] = $subscriber->getCode();
    
        //ADD A NEW FIELD START
    
        //note that the string index for the $data array
        //must match the name of the column created in step 1
        $data['country'] = $subscriber->getCountry();
    
        //ADD A NEW FIELD END
        (...)
    }
    

    Ad. 3)

    You will need to modify (a local copy of) the file app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php. The method you are looking for is called _prepareColumns(). In there you will see a series of calls to $this->addColumn(). You need to add a corresponding call for your "Country" field with the following code:

    $this->addColumn('country', array(
        'header'    => Mage::helper('newsletter')->__('Country'),
        //the index must match the name of the column created in step 1
        'index'     => 'country',
        'default'   =>    '----'
    ));
    

    If you want the field to appear at the end of the grid (as the last column) add it as the last call, otherwise, squeeze it between the existing calls exactly where you want it to end up in the admin.

    Ad. 4)

    This is a part I did not have to do in my customization of the Magento newsletter, so it will be mostly theoretical. The subscription occurs in the controller located at app/code/core/Mage/Newsletter/controllers/SubscriberController.php. Here’s the code of the newAction method with my proposed changes:

    public function newAction()
    {
        if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
            $session   = Mage::getSingleton('core/session');
            $email     = (string) $this->getRequest()->getPost('email');
    
            try {
                if (!Zend_Validate::is($email, 'EmailAddress')) {
                    Mage::throwException($this->__('Please enter a valid email address'));
                }
    
                $status = Mage::getModel('newsletter/subscriber')->subscribe($email);
                if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
                    $session->addSuccess($this->__('Confirmation request has been sent'));
                }
                else {
                    $session->addSuccess($this->__('Thank you for your subscription'));
                }
                    
                    //ADD COUNTRY INFO START
                    
                    //at this point we may safly assume that subscription record was created
                    //let's retrieve this record and add the additional data to it
                    $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
                    
                    //assuming that the input's id is "country"
                    $subscriber->setCountry((string) $this->getRequest()->getPost('country'));
                    
                    //don't forget to save the subscriber!
                    $subscriber->save();
                    
                    //ADD COUNTRY INFO END
            }
            catch (Mage_Core_Exception $e) {
                $session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage()));
            }
            catch (Exception $e) {
                $session->addException($e, $this->__('There was a problem with the subscription'));
            }
        }
        $this->_redirectReferer();
    }
    

    Going through the above steps should take care of the most part of your problem. Let me know how that last part worked out, as I did not have a chance to test it.

    Once you have your additional field in the Subscriber object you can do whatever you want with it. I did not really get what you mean by

    be sent as an email to a preset recipient

    If you can explain that I will try to help you out with this part too.

    Edit – how to send a mail when someone subscribes

    Just add the following code to the controller after the part which adds country to a subscriber object.

    $mail = new Zend_Mail();
    $mail->setBodyHtml("New subscriber: $email <br /><br />Country: ".$this->getRequest()->getPost('country'));
    $mail->setFrom("youremail@email.com")
    ->addTo("admin@mysite.com")
    ->setSubject("Your Subject here");
    $mail->send(); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to magento. Magento default have only email id for newsletter subscrption.
I have a basic newsletter signup form with an email field and two buttons
I need to import 50k email ids for magento newsletter subscription.I found a tutorial
The newsletter subscription form I am working on can be found in the footer
I'm creating a newsletter. Each email contains a link for editing your subscription: <%=
I am editing an ASP form that is basically a newsletter subscription form. The
we build newsletter module, and send email to members. The environment is LAMP. Are
I have a newsletter for one of my sites and I can't the email
I have three forms on one page - callback, contact us and newsletter subscription.
When you submit the newsletter subscription form (subscribe.phtml), the form actions aclls a php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.