Categories
Magento

Magento – Programmatically Subscribe and Unsubscribe Newsletter Subscribers

The following can be a handy snippet. Its usage and placement is totally up to your imagination and requirements.

[php]
/* To Subscribe */
Mage::getModel(‘newsletter/subscriber’)->subscribe(‘[email protected]’);
/* To Unsubscribe */
Mage::getModel(‘newsletter/subscriber’)->loadByEmail(‘[email protected]’)->unsubscribe();
[/php]

2 replies on “Magento – Programmatically Subscribe and Unsubscribe Newsletter Subscribers”

@magormenessy:disqus that’s highly dependent on your scenario. Are you looking to automatically subscribe people when they create an account? Do you simply have a list of emails you’d like to subscribe? Are you looking to subscribe someone after submitting a contact form? etc. etc.

Comments are closed.