jdavidbakr / mail-tracker

Package for Laravel to inject tracking code into outgoing emails.
MIT License
570 stars 129 forks source link

Ability to have bigger content field. #124

Closed pavelsosipovs closed 3 years ago

pavelsosipovs commented 3 years ago

HI! We use you great project in our custom admin panel. All is great. But last time we have one small thing, that cannot customize through config file. We have problem, that sometimes we sends too long emails and they content are cutted before save. As result in admin we cannot see complete email sent. As I see, in database field sent_emails.content by default have type -> text, and it's max size is 65536. I wrote our internal migration to convert it to longtext. But it was not helped, even whole long email now may be stored at content table. After more checking I found that it's cutted by PHP code at vendor/jdavidbakr/mail-tracker/src/MailTracker.php str. 169: 'content' => config('mail-tracker.log-content', true) ? (strlen($original_content) > 65535 ? substr($original_content, 0, 65532) . "..." : $original_content) : null,

So, question, is it possible to add more control to not use magic number 65535 here?

I suggest this string may be changed to following:

'content' => config('mail-tracker.log-content', true) ? (strlen($original_content) > config('mail-tracker.content-max-size', 65535) ? substr($original_content, 0, config('mail-tracker.content-max-size', 65535)) . "..." : $original_content) : null,

And it will allow to manage it more flexible.

Thank you in advance and best regards.

jdavidbakr commented 3 years ago

I can agree to that if you want to make a pull request.