getkirby-v2 / toolkit

This is the deprecated toolkit for Kirby v2.
http://getkirby.com
81 stars 50 forks source link

Integration of external mail services #119

Closed rzschoch closed 8 years ago

rzschoch commented 8 years ago

I’m not sure if it’s intended behaviour, but I had to edit the plain contact form example for using postmark as a service:

      $email = email(array(
        'to' => (string) $page->form_to(),
        'from' => (string) $page->form_from(),
        'subject' => (string) $page->form_subject(),
        'body' => (string) $body,
        'service' => 'postmark',
        'options' => array(
          'key' => c::get('email.postmark.key')
        )
      ));

Before that I tried doing the configuration in the config.php, like described here: http://getkirby.com/blog/email-plugin

c::set('email.use', 'postmark');
c::set('email.postmark.key', 'Your Postmark API Key');
bastianallgeier commented 8 years ago

Unfortunately the guide is outdated. But I just reintroduced the option to configure the email class from the config file. The only exception is that the options are named more consistently:

c::set('email.to', 'mail@example.com');
c::set('email.replyTo', 'mail@example.com');
c::set('email.from', 'mail@example.com');
c::set('email.subject', 'Example');
c::set('email.body', 'Example');
c::set('email.service', 'postmark');
c::set('email.options', array(…));

This is now on the develop branch and will be in 2.2.3