Create mail template

This commit is contained in:
Alexandre Simonet 2016-02-24 10:12:44 +01:00
parent f778675389
commit fdb6a5ddad
5 changed files with 120 additions and 47 deletions

View File

@ -4,10 +4,12 @@ class Process
{
private $data;
private $mail_dir;
private $to;
public function __construct()
{
$this->mail_dir = dirname(__FILE__).'/mails/';
$this->mail_dir = dirname(__FILE__);
$this->to = 'simonet@antadis.com';
}
public function addProvider($post)
@ -16,22 +18,22 @@ class Process
$errors = [];
$isCorrect = $this->validate(Contactform::TYPE_PROVIDER);
if (!$isCorrect) {
$errors[] = 'All fields are not filled';
$errors[] = 'All fields are not filled';
}
$query = Db::getInstance()->autoExecute(_DB_PREFIX_.'contactform', [
'brand' => pSQL($this->data['brand']),
'compagny' => pSQL($this->data['compagny']),
'lastname' => pSQL($this->data['lastname']),
'firstname' => pSQL($this->data['firstname']),
'function' => pSQL($this->data['function']),
'email1' => pSQL($this->data['email1']),
'email2' => pSQL($this->data['email2']),
'phone1' => pSQL($this->data['phone1']),
'phone2' => pSQL($this->data['phone2']),
'purpose' => pSQL($this->data['purpose']),
'content' => pSQL($this->data['content']),
'type' => Contactform::TYPE_PROVIDER
'brand' => pSQL($this->data['brand']),
'compagny' => pSQL($this->data['compagny']),
'lastname' => pSQL($this->data['lastname']),
'firstname' => pSQL($this->data['firstname']),
'function' => pSQL($this->data['function']),
'email1' => pSQL($this->data['email1']),
'email2' => pSQL($this->data['email2']),
'phone1' => pSQL($this->data['phone1']),
'phone2' => pSQL($this->data['phone2']),
'purpose' => pSQL($this->data['purpose']),
'content' => pSQL($this->data['content']),
'type' => Contactform::TYPE_PROVIDER
], 'INSERT');
if (!$query) {
@ -39,18 +41,18 @@ class Process
}
Mail::Send(
intval($cookie->id_lang),
'provider',
'sujet',
[],
'simonet@antadis.fr',
NULL,
$this->data['email1'],
$this->data['lastname'].' '.$this->data['firstname'],
NULL,
NULL,
$this->mail_dir
);
intval($cookie->id_lang),
'provider',
'sujet',
$this->data,
$this->to,
NULL,
NULL,
NULL,
NULL,
NULL,
$this->mail_dir
);
if (!empty($errors)) {
return $errors;
@ -68,34 +70,35 @@ class Process
}
$query = Db::getInstance()->autoExecute(_DB_PREFIX_.'contactform', [
'compagny' => pSQL($this->data['compagny']),
'lastname' => pSQL($this->data['lastname']),
'firstname' => pSQL($this->data['firstname']),
'function' => pSQL($this->data['function']),
'email1' => pSQL($this->data['email1']),
'email2' => pSQL($this->data['email2']),
'phone1' => pSQL($this->data['phone1']),
'phone2' => pSQL($this->data['phone2']),
'content' => pSQL($this->data['content']),
'type' => Contactform::TYPE_PRESS
'compagny' => pSQL($this->data['compagny']),
'lastname' => pSQL($this->data['lastname']),
'firstname' => pSQL($this->data['firstname']),
'function' => pSQL($this->data['function']),
'email1' => pSQL($this->data['email1']),
'email2' => pSQL($this->data['email2']),
'phone1' => pSQL($this->data['phone1']),
'phone2' => pSQL($this->data['phone2']),
'content' => pSQL($this->data['content']),
'type' => Contactform::TYPE_PRESS
], 'INSERT');
if (!$query) {
$errors[] = "something went wrong";
}
Mail::Send(
intval($cookie->id_lang),
'press',
'sujet',
[],
'simonet@antadis.fr',
NULL,
$this->data['email1'],
$this->data['lastname'].' '.$this->data['firstname'],
NULL,
NULL,
$this->mail_dir
intval($cookie->id_lang),
'press',
'sujet',
$this->data,
$this->to,
NULL,
NULL,
NULL,
NULL,
NULL,
$this->mail_dir
);
if (!empty($errors)) {

View File

@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Message de votre boutique</title>
</head>
<body>
<table style="font-family: tahoma,arial,sans-serif; font-size: 12px; color:#000000; width: 550px;">
<tr>
<td align="left" style="background: #514c8c; color:#ffffff; font-size: 12px; font-weight:bold; padding: 0.5em 1em;">Vous avez reçu un message de la part d'un client depuis votre boutique</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left"> <b>{lastname} {firstname}</b> </td>
<td align="left"> {function} </td>
<td align="left"> {compagny} </td>
<td align="left"> Adresse électronique : {email1} {if email2 =! ''} - {email2}{/if} </td>
<td align="left"> Téléphone : Adresse électronique : {phone1} {if phone2 =! ''} - {phone2}{/if} </td>
<td align="left"> &nbsp; </td>
<td align="left"> {content} </td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,9 @@
Vous avez reçu un message de la part d'un client depuis votre boutique
Nom: {lastname} {firstname}
{function}
{compagny}
Adresse électronique : {email1} {if email2 =! ''} - {email2}{/if}
Téléphone : Adresse électronique : {phone1} {if phone2 =! ''} - {phone2}{/if}
{content}

View File

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Message de votre boutique</title>
</head>
<body>
<table style="font-family: tahoma,arial,sans-serif; font-size: 12px; color:#000000; width: 550px;">
<tr>
<td align="left" style="background: #514c8c; color:#ffffff; font-size: 12px; font-weight:bold; padding: 0.5em 1em;">Vous avez reçu un message de la part d'un client depuis votre boutique</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left"> <b>{lastname} {firstname}</b> </td>
<td align="left"> {function} </td>
<td align="left"> {brand} - {compagny} </td>
<td align="left"> Adresse électronique : {email1} {if email2 =! ''} - {email2}{/if} </td>
<td align="left"> Téléphone : Adresse électronique : {phone1} {if phone2 =! ''} - {phone2}{/if} </td>
<td align="left"> &nbsp; </td>
<td align="left"> Proposition : {purpose} </td>
<td align="left"> &nbsp; </td>
<td align="left"> {content} </td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,11 @@
Vous avez reçu un message de la part d'un client depuis votre boutique
Nom: {lastname} {firstname}
{function}
{brand} - {compagny}
Adresse électronique : {email1} {if email2 =! ''} - {email2}{/if}
Téléphone : Adresse électronique : {phone1} {if phone2 =! ''} - {phone2}{/if}
Proposition : {purpose}
{content}