#!/bin/bash

CUSTOMER_NAME="$1"
CUSTOMER_EMAIL="$2"
PRODUCT_NAME="$3"
DETAILS="Quantity: $4"
PAYMENT="$5"
BILLING_EMAIL="Subflexion Billing <billing@subflexion.com>"
CONTACT="support@subflexion.com"
DATE=`date -R`

cat - "$6" << EOF | mailx -a "From: $BILLING_EMAIL" -s "Order Processed" "$CUSTOMER_NAME <$CUSTOMER_EMAIL>"


Dear $CUSTOMER_NAME,


Thank you for purchasing $PRODUCT_NAME. 
We have received your payment of $PAYMENT.

If you were not expecting this email, please contact us at $CONTACT.

You have received this because we have received a payment from PayPal using your email address to order one of our products. 

Please take a moment to check the details of the order below:

Order Details:

	Date: $DATE
	Product: $PRODUCT_NAME
	Price: $PAYMENT
	$DETAILS

Your Details:

	Name: $CUSTOMER_NAME
	Email: $CUSTOMER_EMAIL


If any of the details are not correct, please contact us at $CONTACT.

We will send you an invoice soon. If you do not recieve this in the next 24 hours, please contact us as $CONTACT.
Please find attached your license key.


Kind regards,
Subflexion Team


EOF

