## EMAIL CERTIFICATE

The email certificate info-lostinaustralia-org.cer is used to encrypt bookings emails.

## HOW TO DECRYPT EMAILS

The encrypted booking emails are stored in the tmp folder on the server and can be decrypted using the certificate and the private key.

```
$encrypted_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'bookings') . '/emails/encrypted/';
$decrypted_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'bookings') . '/emails/decrypted/';
$path = drupal_get_path('module', 'bookings');
$cert = file_get_contents($path . '/info-lostinaustralia-org.cer');
$key = file_get_contents($path . '/info-lostinaustralia-org.key');
foreach($emails as $email) {
	$encrypted = $encrypted_path . $email;
	$email = str_replace('enc', 'dec', $email);
	$decrypted =  $decrypted_path . $email;
	openssl_pkcs7_decrypt($encrypted, $decrypted, $cert, $key);
}
```
