X
    Categories: PHP

Mailchimp integration in php

Mailchimp integration in php

Mailchimp are mainly used to maintain subscribers list and send newsletters via mailchimp API to subscribers. Mailchimp features available for various languages/platforms.

Mailchimp supporting languages.

  1. .NET
  2. PHP
  3. Actionscript
  4. GRails
  5. Java
  6. Lasso
  7. node.js
  8. Objective-C
  9. Perl
  10. Python
  11. Ruby on Rails

Check Mailchimp API docs HERE.

In this article we can see easy and simple integration for mailchimp using php.

Please follow below steps:

STEP 1 :

Login in to http://mailchimp.com/ with youe mailchimp credentials.

STEP 2:

Click List in the TOP menu. It will redirect you to the list page which is created by you. Here you can see the lists which is created by you.

STEP 3:

Click Down arrow which is right side of your list name associated row. (Near status button)

Step 4 :

Click Signup Forms


Step 5:

You can see list of singup forms options, Click Embedded Forms.

Step 6:

It will take you to the form embed code page.

Here in the left side you can see the form options, Right side it will show the form layout and embed code.

Choose how the form you like and copy the code which is the text area below of ” Copy/paste onto your site ” line.

Step 7:

Paste the copied code in your page where ever you need and run the page. Now you are ready to play with mailchimp newsletter subscriber form.

*Note if you do not want predefined CSS remove below lines from your copied code.

<link href="//cdn-images.mailchimp.com/embedcode/classic-081711.css" rel="stylesheet" type="text/css">
<style type="text/css">
    #mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
    /* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
       We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>

Sample Code:

<!-- Begin MailChimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-081711.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="//yourdomain.us10.list-manage.com/subscribe/post?u=e7ec2c6a70b923&amp;id=cf2f253" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<h2>Subscribe to our mailing list</h2>
<div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
<div class="mc-field-group">
<label >

 Example => 2

How to make custom script for mailchimp Integration:

<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html">
<title>Custom MailChimp Newsletter Signup - 17educations</title>
<meta name="author" content="Marimuthu M">
<link rel="stylesheet" type="text/css" media="all" href="css/styles.css">
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
</head>

<body>
<div id="topbar">
<a href="http://designshack.net">Back to Design Shack</a>
</div>

<div id="w">
<div id="content">
<h1>Customized MailChimp Newsletter Opt-In Form</h1>

<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="http://us6.list-manage.com/subscribe/post-json?u=58abcfa203271a9db312e69fc&amp;id=ee0af79b60&amp;c=?" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<label >
 

Thanks!. IF you like this article don't forget to share and comment!.

 

Marimuthu: