# Uniform Mail SMTP / Warning

**URL:** <https://forum.getkirby.com/t/uniform-mail-smtp-warning/13302>\
**Category:** Questions\
**Tags:** v2\
**Created:** [March 10, 2019, 10:33am UTC](https://forum.getkirby.com/t/uniform-mail-smtp-warning/13302 "2019-03-10T10:33:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timpulver](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@timpulver](https://forum.getkirby.com/u/timpulver)\
**Post date:** [March 10, 2019, 10:33am UTC](https://forum.getkirby.com/t/uniform-mail-smtp-warning/13302/1 "2019-03-10T10:33:34Z")

</div>

I am trying to set up a form using [Uniform](https://github.com/mzur/kirby-uniform) (Kirby 2 Branch) and PHPMailer using the tutorial [Contact form with phpmailer + Uniform](https://forum.getkirby.com/t/contact-form-with-phpmailer-uniform/6469).

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
<?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');
};

```

@mzur

---

<div class="post-metadata">

**Author:** ![tobystokes](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/tobystokes/32/745_2.png) [@tobystokes](https://forum.getkirby.com/u/tobystokes)\
**Post date:** [March 10, 2019, 12:15pm UTC](https://forum.getkirby.com/t/uniform-mail-smtp-warning/13302/2 "2019-03-10T12:15:34Z")

</div>

I suspect it is because both your to and from addresses are ‘MY\_NAME@gmail.com’ - but gmail can work out it didn’t send it! You may have more luck if you set the from as [something@originatingyourdomain.com](mailto:something@originatingyourdomain.com) - although testing that locally may still product differing results.

I’d really recommend using an external mailing service rather than using phpmailer, and you’ll get the benefit of decent logging. Something like [https://www.mailgun.com/](https://www.mailgun.com/) is free for the level of use of an average contact form, and is easy to integrate with uniform.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:23pm UTC](https://forum.getkirby.com/t/uniform-mail-smtp-warning/13302/3 "2025-02-06T17:23:21Z")

</div>


