Extending alert templates with alert type filtering

If I create an html/php template with the described method and I want to extend this only in one alert type, it will not work correctly.

For example:

@if ($alert->transport == 'mail')
@extends("alerts.templates.marinero")
@section('content')
@if ($alert->state == 1)
<h1>The device {{ $alert->sysName }} ({{ $alert->hostname }}) is not reachable.</h1>
@endif
@if ($alert->state == 0)
<h1>The device {{ $alert->sysName }} ({{ $alert->hostname }}) recovered from down state.</h1>
@endif
@endif
@endsection
@else
@if ($alert->state == 1)
The device {{ $alert->sysName }} ({{ $alert->hostname }}) is not reachable.
@endif
@if ($alert->state == 0)
The device {{ $alert->sysName }} ({{ $alert->hostname }}) recovered from down state.
@endif

This will not work correctly. Email alert is correct, but other alert types, will get this alert as the empty template appended to the end of the alert.
Is it somehow possible to circumvent this?

Any ideas? I did not find solution for this yet.