Se agrega formato de correo y correo a solicitante

This commit is contained in:
2020-04-23 00:19:03 -04:00
parent 667e929b2f
commit ac571273f5
3 changed files with 65 additions and 4 deletions

View File

@ -17,10 +17,18 @@ class Contacto {
$post = $request->getParsedBody();
$body = [];
$filename = implode(DIRECTORY_SEPARATOR, [
$container->get('folders.templates'),
'contacto',
'email.php'
]);
$html = file_get_contents($filename);
foreach ($post as $key => $val) {
$body []= $key . ': ' . $val;
$body []= ucwords($key) . ': ' . $val;
$html = str_replace('{{$' . $key . '}}', $val, $html);
}
$body = implode(PHP_EOL, $body);
$subject = 'Contacto Web - ' . $post['nombre'];
$message = $container->make(Message::class)
@ -29,13 +37,13 @@ class Contacto {
->addCc($container->get('email.administrativo'))
->setSubject($subject)
->setBody($body)
->setHTMLBody(nl2br($body));
->setHTMLBody($html);
$mailer->send($message);
$message = $container->make(Message::class)
->setFrom($container->get('email')['username'])
->addTo($post['email'], $post['nombre'])
->setSubject($subject)
->setBody('Su correo a Notaría Patricio Raby ha sido recibido.');
->setBody('Su correo a Notaría Patricio Raby Benavente ha sido recibido.');
$mailer->send($message);
$output = [