I am trying to set up a form using Uniform (Kirby 2 Branch) and PHPMailer using the tutorial Contact form with phpmailer + Uniform.
Emails are being sent, but Gmail flags them as dangerous. Due to this I added service-options
to use the SMTP-server. But seems like this is not working (because it has no effect on Gmail flagging it as potentially dangerous.
I need to send the form using basic text (no template needed) without it being flagged as dangerous.
I would be grateful for any help! If it is easier without PHPMailer, any help in that direction is very welcome as well.
Below is my controller code. The rest is the same as in the linked tutorial.
<?php
use Uniform\Form;
return function ($site, $pages, $page) {
$form = new Form([
'email' => [
'rules' => ['required', 'email'],
'message' => 'Die Email-Adresse scheint ungültig zu sein',
],
'name' => [],
'message' => [
'rules' => ['required'],
'message' => 'Bitte eine Nachricht eingeben',
],
'receive_copy' => [],
]);
if (r::is('POST')) {
$to = 'MY_NAME@gmail.com';
$form->emailAction([
'to' => $to,
'from' => $to,
'subject' => 'Kontaktanfrage von {name}',
'receive-copy' => false,
'service' => 'phpmailer',
'service-options' => [
'host' => 'smtp.gmail.com',
'port' => 587,
'security' => 'tls',
'user' => 'MY_NAME@gmail.com',
'password' => 'MY_PASSWORD;',
],
]);
}
return compact('form');
};