I am working on a Laravel application where I need to implement email quoting functionality in Blade templates. The goal is to display email threads with proper indentation to show the hierarchy of responses, where each message is quoted in reply to the previous one. Currently, my emails display messages in a flat list, without any visual indication of which messages are replies to others.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
.quote {
margin: 0 0 0 0.8ex;
border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;
}
.attr {
color: #777;
}
</style>
<title></title>
</head>
<body>
<div>
<div>
<!-- Current message -->
<div dir="ltr">{!! nl2br(e($currentMessage['text'])) !!}</div>
<!-- Message history -->
<div class="blockquotes">
@foreach ($messageHistory as $index => $message)
<blockquote class="quote">
<div class="attr">
On {{ $message['created_at']->format('D, M d, Y') }} at {{ $message['created_at']->format('H:i A') }}, {{ $message['author'] }} <{{ $message['email'] }}> wrote:
</div>
<div dir="ltr">{!! nl2br(e($message['text'])) !!}</div>
</blockquote>
@endforeach
</div>
</div>
</div>
</body>
</html>
The current implementation displays messages in a flat list without showing the hierarchical relationship between replies. I need the email thread to visually reflect that each message is a response to a previous message, with each reply indented further to the right based on its nesting level. Currently, the messages do not indicate how they are connected in the conversation.
foreveryoungguy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.