Creating a single opt-in form for your Mail chimp Account is easy and fast. No, no plugins required, no payment. Just a simple understanding of APIs and PHP scripting is enough for creating a single opt-in Mailchimp form for your web page.
So lets get started!!
To clear out the confusion between Double opt-in and Single Opt-in read the following:
1.
Double Opt-In : In this type of form, the user will get a confirmation link on his email, which upon his/her clicking adds them to your list. Otherwise Not!
This type of form is necessary for anti spam measures(So that you dont bombard your users with unwanted emails/newsletters).
2.
Single Opt-in : In this type of form, the user will automatically get added to your mailing list in Mail Chimp.
Such forms are necessary for internal purposes wherein your users have no intentions of blocking you from your newsletters.
Mail Chimp provides form embedded code for your website which is
by default Double Opt-in.
We cannot do anything to that embedded code. So stop banging your head, if you are doing that.
Mail chimp provides API wrappers for all scripting languages, where in you can
turn off / disable the double-opt-in option.
But in case you are planning to abuse the stuff!!!!!!
Visit this link :
http://mailchimp.com/contact/abuse/
So make good use of this information and go ahead.
Before beginning you need to have following:
1. An authentic API key provided to you for your account
2. The list ID of your list that you want the users emails to get subscribed to
You will get both from the Mailchimp Website.
Now to begin with you first need to get the API wrapper from
http://apidocs.mailchimp.com/api/downloads/
Download the .zip file of the latest API wrapper for PHP provided and extract the contents to a suitable place.
Now in the examples folder get the following files:
1. /inc/config.inc.php
2. /inc/MCAPI.class.php
3. mcapi_listSubscribe.php
Copy these files to another destination.(Most suitably in the folder where you have your HTML form code residing).
Follow these steps and VOILA!!!!! you will be done:
1. Open 'config.inc.php'
Change the
$apikey with the your API Key.
Change $listID with the ID of list you want the user to subscribe to.
Delete the line having variable $myemail.
Save the file and exit.
2. open the file 'mcapi_listSubscribe.php'
Change the require_once addresses by removing
'/inc/'. for both the imported files.
Remove
$merge_vars variable initialization.
Here you need to get the emailID of user by either $_GET or $_POST method from your form into a variable like
$subscriberemailID = $_POST["EMAIL"];
In the function (listSubscribe()) calling line replace $myemail(we deleted it!Remember?) by the variable holding the user Email ID($subscriberemailID).
Equalize $merge_vars = null
You can change the echo function if you want.(For coders only!).
Save the file and exit.
3. Open 'MCAPI.class.php' (The crux of magic)
Find function definition of 'listSubscribe'.
In the parameters passed into it you will see a parameter $double_optin being passed as TRUE. Change it to FALSE. (That is all to this head banging stuff!!!!).
Save the file and exit.
So i guess, you have the form ready and raring to go ahead.
Now in your form code put action of your form as action = "mcapi_listSubscribe.php"
or the location of above mentioned file.
Run the form, fill it up, submit the form and the user email ID will be added directly to your Mail Chimp list
without any confirmation email being sent to the user.