Files
leadchat/app/views/mailers/conversation_reply_mailer/conversation_transcript.html.erb
Sojan Jose 3da26ee025 feat: Move email attachments from links to file attachments (#11304)
Add ability to send files as attachments instead of links
Fixes: https://github.com/chatwoot/chatwoot/issues/1074


## Changes 
- `emaily_reply` : We will attach the small attachments as attachments
and large ones as links
- `reply_with_summary`, `conversation_transcript`,
`reply_with_out_summary` : We will change the attachment format to the
following instead of the previous `View the attachment here`

```
Attachments:
file_name
file_name2
```


---------

ref: https://github.com/chatwoot/chatwoot/pull/10318/files -> for fixing
: https://github.com/chatwoot/chatwoot/pull/9655#issuecomment-2183962550

---------

Co-authored-by: Marco Marinho <marcomarinho12@gmail.com>
Co-authored-by: Pranav <pranavrajs@gmail.com>
2025-04-15 23:43:12 -07:00

51 lines
2.1 KiB
Plaintext

<% @messages.each do |message| %>
<tr>
<td>
<b><%= message.sender&.try(:available_name) || message.sender&.name || '' %></b>
<% if message.conversation.inbox&.inbox_type == 'Email' %>
<div style="font-size: 90%; color: #899096; line-height: 16px">
<% if message.content_attributes.dig(:email, :from).present? %>
<div>From: <%= message.content_attributes.dig(:email, :from).join(", ") %></div>
<% else %>
<div>From: <%= message.sender&.try(:email) %></div>
<% end %>
<% if message.content_attributes.dig(:email, :subject).present? %>
<div>Subject: <%= message.content_attributes.dig(:email, :subject) %></div>
<% end %>
<% if message.content_attributes[:to_emails].present? %>
<div>To: <%= message.content_attributes[:to_emails].join(", ") %></div>
<% end %>
<% if message.content_attributes[:cc_emails].present? %>
<div>CC: <%= message.content_attributes[:cc_emails].join(", ") %></div>
<% end %>
<% if message.content_attributes[:bcc_emails].present? %>
<div>BCC: <%= message.content_attributes[:bcc_emails].join(", ") %></div>
<% end %>
</div>
<% end %>
</td>
</tr>
<tr>
<td style="padding-bottom: 32px;">
<% if message.content %>
<%= ChatwootMarkdownRenderer.new(message.content).render_message %>
<% end %>
<% if message.attachments.present? %>
<p>Attachments:</p>
<% message.attachments.each do |attachment| %>
<p><a href="<%= attachment.file_url %>" target="_blank"><%= attachment.file.filename.to_s %></a></p>
<% end %>
<% end %>
<p style="font-size: 90%; font-size: 90%;color: #899096;margin-top: -8px; margin-bottom: 0px;">
<% if @inbox.timezone.present? %>
<%= message.created_at.in_time_zone(@inbox.timezone).strftime('%b %d, %I:%M %p %Z') %>
<% else %>
<%= message.created_at.strftime('%b %d, %I:%M %p %Z') %>
<% end %>
</p>
</td>
</tr>
<% end %>