# Get email from form

**URL:** <https://discourse.getcockpit.com/t/get-email-from-form/1875>\
**Category:** Support\
**Created:** [March 16, 2021, 6:42am UTC](https://discourse.getcockpit.com/t/get-email-from-form/1875 "2021-03-16T06:42:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikinig](https://avatars.discourse-cdn.com/v4/letter/v/8e7dd6/32.png) [@Vikinig](https://discourse.getcockpit.com/u/Vikinig)\
**Post date:** [March 16, 2021, 6:42am UTC](https://discourse.getcockpit.com/t/get-email-from-form/1875/1 "2021-03-16T06:42:31Z")

</div>

I am new to cockpit and have been struggleling with my mailer. I have been through old answers and set up a config.yaml mailer. it looks like this

‘mailer’:  
‘from’ : ‘foo@domain.dk’,  
‘from\_name’ : ‘foo’,  
‘transport’ : ‘smtp’,  
‘host’ : ‘[send.one.com](http://send.one.com)’,  
‘user’ : ‘emailuser’,  
‘password’ : ‘emailpassword’,  
‘port’ : 465,  
‘auth’ : true,  
‘encryption’ : starttls

In the examples from this forum the mailer has no ‘’ but if I remove them, the fetch itselves doesnt work. this is how my fetch look.

fetch(`${domain}/api/forms/submit/kontaktarne?token=${apiKey}`, {  
method: ‘post’,  
headers: { ‘Content-Type’: ‘application/json’ },  
body: JSON.stringify({  
form: {  
Navn: `${document.querySelector('#navn').value}`,  
Adresse: `${document.querySelector('#address').value}`,  
Postnummer: `${document.querySelector('#postnummer').value}`,  
By: `${document.querySelector('#by').value}`,  
Telefon: `${document.querySelector('#tel').value}`,  
Email: `${document.querySelector('#email').value}`,  
Besked: `${document.querySelector('#message').value}`  
}  
})  
})  
.then(entry =\> entry.json())  
.then(entry =\> {console.log(entry)})

please help me understand what i am doing wrong

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [March 23, 2021, 5:40pm UTC](https://discourse.getcockpit.com/t/get-email-from-form/1875/2 "2021-03-23T17:40:57Z")

</div>

Do you have a `config.php` and a `config.yml` file in your config folder? If so, the yaml file will be ignored and your cockpit doesn’t know about your mailer setup.

If you use a yaml file (deprecated) instead of a php config file, you don’t need the quotation marks, but you have to care about correct indentation.

---

<div class="post-metadata">

**Author:** ![Vikinig](https://avatars.discourse-cdn.com/v4/letter/v/8e7dd6/32.png) [@Vikinig](https://discourse.getcockpit.com/u/Vikinig)\
**Post date:** [March 26, 2021, 6:33am UTC](https://discourse.getcockpit.com/t/get-email-from-form/1875/3 "2021-03-26T06:33:52Z")

</div>

Thanks. 😄 It works just perfekt now. I had a .php file in the same folder.
