After upgrading to Laravel 9, all the emails that are sent from my application contain broken links (instead of the correct link) in Gmail (and also Yahoo mail). Basically, the value of the href
attribute in my email views is replaced by a broken link:
https://email.mail.mydomain.io/c/eJxNjksKwyAURVejsxY_-ZiBg0DJAroDfe-ZWJIYjC1093VSWrijw7mXi9ZJcjxa8OD7VptBUStV32NwEgVqYzqgBgNrRMkOV8rXmPhifQAUCrAbTOeVwSYEGVpQyvsKheerXUo5TqZHpqaab_u3UuEcX3TJBGneY4lpr_p0PrfN5TfTtzsBVQF5tg93HpT_TkD6AIjKPZE
Here is my email view:
@extends('layouts.mail')
@section('title')
{{ $subject }}
@endsection
@section('body')
<img src="{{ tenant_config('logo_path') ?? global_asset("/img/logo/logo.png") }}" alt="{{ tenant_config('company_name') }}" style="display:block;max-width:300px;margin-top:.5rem;margin-bottom:30px;margin-right:auto;margin-left:auto;" >
<h1 style="text-align:center;margin-top:0;margin-bottom:1rem;margin-right:0;margin-left:0;font-size:2.4rem;color:#3bafbf;" >
{{ $hit->reward }}<span >{{ __('global.pts') }}</span>
</h1>
<p style="text-align:center;margin-top:0;margin-bottom:1rem;margin-right:0;margin-left:0;" >
{{ __('mails/notification.there_is_time', ['name' => $hit->user->firstname]) }}
</p>
<p style="text-align:center;margin-top:0;margin-bottom:1rem;margin-right:0;margin-left:0;" >
{{ __('mails/notification.dont_reply') }}
</p>
<p style="text-align:center;margin-top:0;margin-bottom:1rem;margin-right:0;margin-left:0;" >
<a href="{{ $actionUrl }}" style="background-color:#3bafbf;text-decoration:none;color:#ffffff;padding-top:.75rem;padding-bottom:.75rem;padding-right:1.5rem;padding-left:1.5rem;transition:box-shadow 150ms ease-in-out;display:inline-block;margin-top:5px;border-radius:4px;box-shadow:0 3px 6px rgba(0, 0, 0, 0.1);font-size:1.5rem;" >{{ __('mails/global.visit_my_profile') }}</a><br>
</p>
@endsection
How can this be fixed?
I have also been using the archtechx/tenancy
package for multi-tenancy.
CodePudding user response:
I found the solution. My email service provider (Mailgun) is replacing my email links with tracking links to track clicks. I just had to set the tracking protocol in Mailgun from http
to https
, which fixed it.