Implementado servicio de envio de emails y funcion de envio a correo unico en etorno de desarrollo

This commit is contained in:
unknown
2025-03-27 12:08:09 +01:00
parent 4a6b974e94
commit f37805d310
4 changed files with 31 additions and 85 deletions

View File

@ -40,7 +40,7 @@ class ChatService extends BaseService
protected array $modelClassMap;
public function __construct()
{
$this->emailService = service('email');
$this->emailService = service('emailService'); // Usar el servicio de email de Safekat y no el de CI4
$this->userModel = model(UserModel::class);
$this->chatModel = model(ChatModel::class);
$this->chatMessageModel = model(ChatMessageModel::class);
@ -186,10 +186,15 @@ class ChatService extends BaseService
{
$users = auth()->getProvider();
$toEmail = $users->find($user->id)->getEmail();
$this->emailService->setTo($toEmail);
$subject = '[Safekat]' . lang('Chat.mail.mail_subject') . '-' . $chatMessageEntity->chat()->title;
$this->emailService->setSubject($subject);
$this->emailService->setMessage(view('themes/vuexy/mail/messageNotification', ["header" => lang('Chat.mail.mail_subject'), "data" => $chatMessageEntity->withUser()]));
return $this->emailService->send();
$subject = '[Safekat]' . lang('Chat.mail.mail_subject') . ' - ' . $chatMessageEntity->chat()->title;
$message = view('themes/vuexy/mail/messageNotification', [
"header" => lang('Chat.mail.mail_subject'),
"data" => $chatMessageEntity->withUser(),
]);
return $this->emailService->send($subject, $message, $toEmail);
}
}