Subscribe new users automatically to your MailChimp* list by using e-mail piping
- Processes the received e-mail message and parses the name, surname and from address.
- Registers the user to the newsletter by sending the data via MailChimp API.
- Writes log files
mailchimp.log(logs subscription info) andemails.log(optional, see configuration) for diagnostics.
- Edit the
config.inc.phpand add your MailChimp API key and list ID. - On your server, create a new directory (preferably outside
public_html) and upload the PHP files. - Setup a pipe to the script
| /home/user/script_dir/mailchimp.php. This maybe slightly different depending on your hosting provider. Please check the docs. - If you don't want to write a detailed log file including the e-mail body, in
mailchimp.php, set$detailedLoggingtofalse. - Do not forget to make
mailchimp.phpscript executable. Something likechmod 755 mailchimp.phpshould do it.
The first line has to point to the PHP command line on the server, something like:
#!/usr/bin/php -q or #!/usr/local/bin/php -q
Immediately after this line, <?php tag should start. This is to ensure that the
file does not have any output. Make sure that there aren't any extra spaces and
line feeds outside <?php ... ?>, and also avoid using output functions like
echo() or var_dump().
Otherwise, even though the script will work as expected, the sender of the e-mail will receive an e-mail indicating that his message was not delivered along with the output of the PHP script. You definitely don't want that.
- PlancakeEmailParser by Danyuki Software Limited
- MailChimp API 1.3 and MCAPI PHP Wrapper 1.3.2
-- Coded by @tolgamorf on Mar 11, 2013.