Postmark App for all emails

Hi, I can send a test email from a stand alone page using Postmark but when I try to set the parameters in the config file it won’t work.

I’ve tried installing the Plugin but that can’t see the created function, also it seems a bit unneccisary having a plugin when you should just be able to set it in the config?

Is there something obvious that I’m missing? I’m trying to ensure that the reset password code emails from Kirby can be tracked. Any help would be greatly apprecited.

While the plugin currently only seems to implement SMTP transport, there is another option at least planned. But yes, it should be possible only with the correct transport settings.

The plugin has the following config setup:

        'email' => [
            'transport' => [
                'type' => 'smtp',
                'host' => 'smtp.postmarkapp.com',
                'port' => 587,
                'security' => 'tsl',
                'auth' => true,
                'username' => 'apikey'
                'password' => 'apisecret'
            ]

You might want to compare that with your setup. Also make sure that all config settings are within one return array.

Thanks for getting back to me, I have manged to get the example below working correctly (on a stand alone page) with the plugin but the KirbyCMS emails (password reset emails) are not being sent by Postmark, how do I tell Kirby to send all emails through Postmark?

Preformatted text// regular "transactional" email
$to = 'roger.rabbit@disney.com';

$success = kirby()->email([
    'from' => new \Kirby\Cms\User([
        'email' => 'postmark@example.com', // your verified postmark sender
        'name' => 'Example Name', // your name
    ]),
    'to' => $to,
    'subject' => 'Sending E-Mails is fun',
    'body' => [
        'html' => '<h1>Headline</h1><p>Text</p>',
        'text' => "Headline\n\nText",
    ],
    'transport' => postmark()->transport(), // plugin helper to get SMTP config array
])->isSent();

Again, any help would be greatly apprecited.

I wonder if you have to set a from preset for the password email to work, but not sure.

http://getkirby.test/docs/reference/system/options/email#email-presets

The transport setting should work with the password reset emails.

Thanks but that dosn’t seem to make any difference, all the settings are in the index file of the plugin, the only line in the Kirby config file is:

'bnomei.postmark.apitoken' => 'Postmark Key Goes Here',

If I add any of the details to the Kirby config file it fails…

Well, I don’t know if the plugin works nicely with the reset email.

I’d just try with the config settings. If Postmark is testable, I will try tonight.

Thanks very much for your help!

Ok, after creating an account myself, I have now found what the problem is. You need a verified sender name, which you have to set with the auth config options:

return [
    // …other settings
    'auth' => [
        'methods' => ['password', 'password-reset'],
        'challenge' => [
            'email' => [
                'from'     => 'myverifiedsender@mydomain.com',
                'fromName' => 'My Name',
            ]
        ]
    ],
    'email' => [
        'transport' => [
            'type' => 'smtp',
            'host' => 'smtp.postmarkapp.com',
            'port' => 587,
            'security' => true,
            'auth' => true,
            'username' => 'username',
            'password' => 'password',
        ]
    ]
];
1 Like

thanks @texnixe for your help regarding my plugins. :heart:

I now created an issue to investigate this myself as well.

Thanks very much @texnixe I tried that but I still can’t get it to authenticate, are you just using the information above without the plugin or are you using the plugin as well?

Working now! I changed the Username and Password to the Access Key and a generated SMTP Token and it works, thanks so much for your help @texnixe

I didn’t use the plugin for testing, but just the config settings I posted above, with username and password settings from the Postmark SMTP settings page.

Yes that’s what I’ve got working - all in the config file. Again, thanks so much for your help.