Get email from form

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’,
‘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

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.

1 Like

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