mailersend / mailersend-laravel-driver

The official MailerSend Laravel Driver
https://developers.mailersend.com
MIT License
72 stars 20 forks source link

Using mailersend driver in laravel with a Mailable, errors out with message, One of template_id or text must be supplied #42

Closed Alkwarizm closed 9 months ago

Alkwarizm commented 9 months ago

I am using mailersend driver in my laravel application. I have installedmailersend/laravel-driver successfully. Configured my .env variables, MAIL_MAILER=mailersend MAILERSEND_API_KEY=xxxxx MAIL_FROM_ADDRESS="no-reply@xxxx" MAIL_FROM_NAME="${APP_NAME}"

My mailable class:

`class ClientAccountCredentials extends Mailable { use Queueable, SerializesModels;

public function __construct(
    public Client $client,
)
{
}

public function envelope(): Envelope
{
    return new Envelope(
        to: [$this->client->email],
        subject: "Your {$this->client->company->name} Account Credentials"
    );
}

public function content(): Content
{
    return new Content(
        view: 'emails.client-account-credentials',
    );
}

public function attachments(): array
{
    return [];
}

}`

How it's initiated: Mail::to( users: $client )->send( mailable: new ClientAccountCredentials( client: $client, ) );

The error One of template_id or text must be supplied {"userId":1,"exception":"[object] (MailerSend\\Exceptions\\MailerSendAssertException(code: 0): One of template_id or text must be supplied at /var/www/html/project/public_html/vendor/mailersend/mailersend/src/Helpers/GeneralHelpers.php:23)

fosron commented 9 months ago

Please contact our support https://www.mailersend.com/contact-us