Repository: quarkusio/quarkus
Issue: [Quarkus 3.0.0.CR2] [quarkus-mailer] NullPointerException when sending with MailTemplateInstance

### Description
Hello,
when sending an email with:

     @CheckedTemplate
     static class Templates {
         public static native MailTemplate.MailTemplateInstance mailTemplate(String something);
     }

via

`Templates.mailTemplate("This is an email").to("test@email.org").subject("Something happened").send()`

in a Resteasy Reactive resource I get a NullPointerException. It seems that no mailer gets injected.

### Stacktrace

    java.lang.NullPointerException: Cannot invoke "io.quarkus.mailer.reactive.ReactiveMailer.send(io.quarkus.mailer.Mail[])" because "this.this$0.mailer" is null
	    at io.smallrye.mutiny.groups.UniOnFailure.lambda$call$3(UniOnFailure.java:108)
	    at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
	    at io.smallrye.mutiny.operators.uni.UniOnFailureTransform$UniOnFailureTransformProcessor.onFailure(UniOnFailureTransform.java:54)
	    at io.smallrye.mutiny.operators.uni.UniOperatorProcessor.onFailure(UniOperatorProcessor.java:55)
	    at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.onFailure(UniOnItemOrFailureFlatMap.java:67)
	    at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.onFailure(UniOnItemOrFailureFlatMap.java:67)
	    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownFailure$KnownFailureSubscription.forward(UniCreateFromKnownFailure.java:38)
	    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownFailure.subscribe(UniCreateFromKnownFailure.java:23)
	    at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
	    at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.performInnerSubscription(UniOnItemOrFailureFlatMap.java:99)
	    at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.onItem(UniOnItemOrFailureFlatMap.java:54)
	    at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:43)
	    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
	    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
	    at io.smallrye.mutiny.operators.uni.UniOperatorProcessor.onItem(UniOperatorProcessor.java:47)
	    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage$CompletionStageUniSubscription.forwardResult(UniCreateFromCompletionStage.java:63)
	    at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
	    at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
	    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	    at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
	    at org.hibernate.reactive.util.async.impl.AsyncTrampoline$TrampolineInternal.unroll(AsyncTrampoline.java:131)
	    at org.hibernate.reactive.util.async.impl.AsyncTrampoline$TrampolineInternal.lambda$unroll$0(AsyncTrampoline.java:126)
	    at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
	    at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
	    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	    at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
	    at io.vertx.core.Future.lambda$toCompletionStage$3(Future.java:384)
	    at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
	    at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	    at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	    at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
	    at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:100)
	    at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:34)

I am working in a reactive environment with following extensions:

### Environment

      dependencies {
          implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
          implementation("io.quarkus:quarkus-hibernate-reactive-panache")
          implementation("io.quarkus:quarkus-resteasy-reactive-jackson")
          implementation("io.smallrye.reactive:smallrye-mutiny-vertx-web-client")
          implementation("io.quarkus:quarkus-reactive-mysql-client")
          implementation("io.quarkus:quarkus-hibernate-validator")
          implementation("io.quarkus:quarkus-smallrye-openapi")
          implementation("io.quarkus:quarkus-config-yaml")
          implementation("io.quarkus:quarkus-scheduler")
          implementation("io.quarkus:quarkus-qute")
          implementation("io.quarkus:quarkus-mailer")
          implementation("io.quarkus:quarkus-arc")
          testImplementation("io.quarkus:quarkus-junit5")
          testImplementation("io.rest-assured:rest-assured")
      }

    #Gradle properties
    #Tue Apr 18 20:56:58 CEST 2023
    quarkusPluginVersion=3.0.0.CR2
    quarkusPlatformArtifactId=quarkus-bom
    quarkusPluginId=io.quarkus
    quarkusPlatformGroupId=io.quarkus.platform
    quarkusPlatformVersion=3.0.0.CR2

As a workaround I need to Inject an unused instance of ReactiveMailer to be able to send an email.

    @Inject
    ReactiveMailer reactiveMailer;

Using the bare reactiveMailer works, too.

If you need further information please tell me.

Changed files:
extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java

diff --git a/extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java b/extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java
index 4d5dc582cf7..26efb777517 100644
--- a/extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java
+++ b/extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java
@@ -27,6 +27,7 @@
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.annotations.ExecutionTime;
 import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
 import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
 import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
@@ -45,6 +46,7 @@
 import io.quarkus.mailer.runtime.Mailers;
 import io.quarkus.mailer.runtime.MailersBuildTimeConfig;
 import io.quarkus.mailer.runtime.MailersRuntimeConfig;
+import io.quarkus.qute.CheckedTemplate;
 import io.quarkus.qute.deployment.CheckedTemplateAdapterBuildItem;
 import io.quarkus.qute.deployment.QuteProcessor;
 import io.quarkus.qute.deployment.TemplatePathBuildItem;
@@ -91,13 +93,15 @@ void registerBeans(BuildProducer<AdditionalBeanBuildItem> beans) {
     @Record(ExecutionTime.STATIC_INIT)
     @BuildStep
     MailersBuildItem generateMailerSupportBean(MailerRecorder recorder,
+            CombinedIndexBuildItem index,
             BeanDiscoveryFinishedBuildItem beans,
             BuildProducer<SyntheticBeanBuildItem> syntheticBeans) {
         List<InjectionPointInfo> mailerInjectionPoints = beans.getInjectionPoints().stream()
                 .filter(i -> SUPPORTED_INJECTION_TYPES.contains(i.getRequiredType().name()))
                 .collect(Collectors.toList());
 
-        boolean hasDefaultMailer = mailerInjectionPoints.stream().anyMatch(i -> i.hasDefaultedQualifier());
+        boolean hasDefaultMailer = mailerInjectionPoints.stream().anyMatch(i -> i.hasDefaultedQualifier())
+                || !index.getIndex().getAnnotations(CheckedTemplate.class).isEmpty();
 
         Set<String> namedMailers = mailerInjectionPoints.stream()
                 .map(i -> i.getRequiredQualifier(MAILER_NAME))