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

https://github.com/shuhaoliu/php-email-scripts

A Docker image for sending out template emails
https://github.com/shuhaoliu/php-email-scripts

Last synced: 28 days ago
JSON representation

A Docker image for sending out template emails

Awesome Lists containing this project

README

          

# PHP Email Scripts

This Docker image can be used to send template emails.

> *Note:* This image is built on top of the ```php:5.6-apache``` image, which has an Apache web server running. We are not using any of the features provided by the web server, but it is the most convenient way of running php scripts.

## Customization

### *CC* and *BCC* list

Please customize the email headers before use. In ```send_email.php```, change the ```CC:``` and the ```BCC:``` list in the following lines:

```php
$headers = "From: Sender Name " . "\r\n" .
'Reply-To: Sender Name ' . "\r\n" .
//'CC: CC ' . "\r\n" .
//'BCC: BCC ' .
"";
```

### *From* Email Address

Customizing the ```FROM``` address is a little bit trickier if the IMAP server name is changed. Say, if the new email address is ```test@newserver.com```, modify the following line in ```runWithMail.php```

```shell
echo "$line server.com $host" >> /etc/hosts
```
to

```shell
echo "$line newserver.com $host" >> /etc/hosts
```
before building the Docker image.

## Launching the Container

+ ```cd php-email-scripts```
+ Build the docker image. ```docker build -t php-email .```
+ Run the container (in background). ```docker run -d --name container_name php-email```
+ Attach a shell to the container. ```docker exec -it container_name /bin/bash```

Then, the shell is ready to run ```send_email.php```.

## Usage

```shell
php send_email.php [recipient_email] [score1] [score2] [score3]
```

+ ```recipient_email``` is the email address of the recipient. Acceptable formats include ```name@server.com``` and ```Full Name ```.

+ ```score*``` is the score for each criteria.