| @@ -83,9 +83,9 @@ | ||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if ($block['type'] == 'boxed_content') { |
| 86 | 86 | return (string)App::make('view')->make('email.Default._user_box_content', [ |
| 87 | - 'user_name' => $block['options']['user']->display_name, | |
| 87 | + 'user_name' => $block['options']['user']->getPublicDisplayName(), | |
| 88 | 88 | 'user_avatar' => !(empty($block['options']['user']->xprofile->avatar)) ? $block['options']['user']->xprofile->avatar : $block['options']['user']->photo, |
| 89 | 89 | 'content' => $block['content'], |
| 90 | 90 | 'permalink' => $block['options']['permalink'], |
| 91 | 91 | 'post_content' => $block['options']['post_content'], |
| @@ -94,9 +94,9 @@ | ||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | if ($block['type'] == 'post_boxed_content') { |
| 97 | 97 | return (string)App::make('view')->make('email.Default._user_post_content', [ |
| 98 | - 'user_name' => $block['options']['user']->display_name, | |
| 98 | + 'user_name' => $block['options']['user']->getPublicDisplayName(), | |
| 99 | 99 | 'user_avatar' => !(empty($block['options']['user']->xprofile->avatar)) ? $block['options']['user']->xprofile->avatar : $block['options']['user']->photo, |
| 100 | 100 | 'content' => $block['content'], |
| 101 | 101 | 'title' => Arr::get($block['options'], 'title'), |
| 102 | 102 | 'permalink' => $block['options']['permalink'], |
| @@ -220,8 +220,19 @@ | ||
| 220 | 220 | if ($this->headingBlocks) { |
| 221 | 221 | $data['headingContent'] = $this->complileHeadingBlocks(); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - return (string)App::make('view')->make('email.template', $data); | |
| 224 | + $html = (string)App::make('view')->make('email.template', $data); | |
| 225 | + | |
| 226 | + // Inline the <head><style> rules onto each element so they survive clients and | |
| 227 | + // log viewers that strip the document head (Outlook, FluentSMTP's DOMPurify | |
| 228 | + // preview). @media/:hover rules can't be inlined and are kept in a <style> tag. | |
| 229 | + try { | |
| 230 | + $html = (new Emogrifier\Emogrifier($html))->emogrify(); | |
| 231 | + } catch (\Throwable $e) { | |
| 232 | + // Fall back to the un-inlined HTML; the <head><style> still covers Gmail. | |
| 233 | + } | |
| 234 | + | |
| 235 | + return $html; | |
| 225 | 236 | } |
| 226 | 237 | |
| 227 | 238 | } |