Templates

Now, there is some convention in directory structure and you should stick to it. It doesn't matter where you put your mails, but the Mail class (which your mails will inherit from) will look for template latte files in <same_directory_as_your_mails_are</templates. The name of particular template has to be in camel_case naming convention. E.g.:

app/
	Mailing/
		ContactMail.php
		templates/
			contact_mail.latte

But that is only a recommendation. You can always change your template file path by Mail::setTemplateFile(). Eg:

In your mail class:

# ...

public function compose(Nette\Mail\Message $message, $params = NULL)
{
	# ...
	
	$this->setTemplateFile(__DIR__ . '/templates/contact_mail.latte');
}

From outside:

# ...

$mail = $mailFactory->createByType('App\Mailing\ContactMail', ['recipient' => 'hello@hello.hello']);
$mail->setTemplateFile('super_awesome_template.latte');

No templates

Of course you don't have to send mails with templates, you can just use plaintext mail body. You would do that probably in your mail class:
# ...

public function compose(Nette\Mail\Message $message, $params = NULL)
{
	# ...
	
	$message->setBody('Hello');
}
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tím souhlasíte. V pořádku Další informace