A Kirby email service for MailTrap
If you are using the Kirby CLI you can install this plugin by running the following command in your shell from the root folder of your Kirby installation:
kirby plugin:install mightymango/mailtrap
Download this archive, extract it and rename it to mailtrap
. Copy the folder to your site/plugins
folder.
If you know your way around git, you can download this as a submodule:
git submodule add https://github.com/mightymango/mailtrap/ site/plugins/mailtrap
To use this mail service add the following to your config.php file:
c::set('mailtrap.host', 'smtp.mailtrap.io');
c::set('mailtrap.port', 2525);
c::set('mailtrap.username', "<Your username>");
c::set('mailtrap.password', "<Your password>");
To send emails using MailTrap, set mailtrap
as the email service:
$email = email(array(
'service' => 'mailtrap',
'to' => 'peter@example.com',
'from' => 'johndoe@email.com',
'subject' => 'Sending emails with Kirby is easy',
'body' => 'Hey! This was really easy!'
));
if($email->send()) {
echo 'The email has been sent';
} else {
echo $email->error();
}
Currently this service will only accept email addresses formated as peter@example.com
.
Emails using an address such as Peter <peter@example.com>
will fail.
Readme file based on template by Thiousi
Uses PHPMailer to send.
MIT
- Initial release