An open API service indexing awesome lists of open source software.

https://github.com/grevory/simple-php-mailing-list

A simple PHP/MySQL email collection class subscribing, unsubscribing, and getting all subscribers.
https://github.com/grevory/simple-php-mailing-list

Last synced: 3 months ago
JSON representation

A simple PHP/MySQL email collection class subscribing, unsubscribing, and getting all subscribers.

Awesome Lists containing this project

README

        

# Simple PHP Mailing List Docs

## Initiate the class
```php
$mailingList = new SimpleMailingList();
```

## Configure the DB
```php
$db = array(
'host'=>'localhost',
'username'=>'me',
'password'=>'mypassword',
'database'=>'dbname',
'table'=>'subscribers'
);
$mailingList->setDbConfig($db);
```

## Subscribe a new email
```php
$mailingList->subscribe('[email protected]');
$mailingList->subscribe('[email protected]');
```

## Unsubscribe an existing email
```php
$mailingList->unsubscribe('[email protected]');
```

## Get a list of subscribers
```php
echo implode(', ',$mailingList->getAllSubscribers());
```

## Get a list of subscribers including those who have opted out
```php
echo implode(', ',$mailingList->getAllSubscribers(true));
```

## Check to see if an email is subscribed
```php
var_dump($mailingList->emailExists('[email protected]'));
```