Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/Http/Controllers/LeadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -840,9 +840,19 @@ public function convertToDeal(ConvertToDealRequest $request, Lead $lead)
CreateUser::dispatch($request, $client);

if ($enableEmailVerification === 'on') {
// Apply dynamic mail configuration
SetConfigEmail(creatorId());
$client->sendEmailVerificationNotification();
try {
// Apply dynamic mail configuration
SetConfigEmail(creatorId());
$client->sendEmailVerificationNotification();
} catch (\Throwable $e) {
// SetConfigEmail() throws when the company has no SMTP set up.
// The client already exists and the deal still has to be made,
// so a missing mail server must not fail the conversion.
\Log::warning('Client created but its verification email could not be sent', [
'client_id' => $client->id,
'error' => $e->getMessage(),
]);
}
}
}

Expand All @@ -852,7 +862,14 @@ public function convertToDeal(ConvertToDealRequest $request, Lead $lead)
];

// Send Email to client if they are new created.
EmailTemplate::sendEmailTemplate('New User', [$client->id => $client->email], $cArr);
try {
EmailTemplate::sendEmailTemplate('New User', [$client->id => $client->email], $cArr);
} catch (\Throwable $e) {
\Log::warning('Could not send the new client its welcome email', [
'client_id' => $client->id,
'error' => $e->getMessage(),
]);
}

$stage = DealStage::where('pipeline_id', $lead->pipeline_id)->first();
if (!$stage) {
Expand Down
Loading