So MailChimp let your users to susbscribe and you can send them newsletters in bulk and manage your subscriber's lists. Although MailChimp provide forms and lot of APIs and functions but for that you need to google and search, it takes time.
Here I'll show you how you can simply write some code in to your site while keeping your users on site without going to MailChimp.
After successfull account creation and activation, Generate your API keys and List ID.
So here you go all done with basic code setup, make changes as you need with code.
Note:
MailChimp does not show subscribers in your created list unless user activated their email. When user subscribes MailChimp send activation URL so only valid emails can subscribe.
Here I'll show you how you can simply write some code in to your site while keeping your users on site without going to MailChimp.
Things which are required before you start code.
Sign Up on MailChimp
- Go to your Account Settings -> Extras -> API Keys
- Click on Create a Key button and you will have you API key ready.
- After that go to Lists section, Create List, Visit your created lists under Settings -> List name & defaults you will find List ID.
Now you need to download API files
Download MailChimp API
I am using version2.0 API.
PHP CODE
MailChimp API send request through CURL so make sure you have enabled CURL in your PHP.
Create a php file subscribe.php
Place this inside subscribe.php file.
HTML
Create a index.html, place following code
JAVASCRIPT
Add jquery <script src="jquery.min.js" type="text/javascript"></script>
So here you go all done with basic code setup, make changes as you need with code.
Note:
MailChimp does not show subscribers in your created list unless user activated their email. When user subscribes MailChimp send activation URL so only valid emails can subscribe.