Created
April 13, 2018 21:12
-
-
Save israeleriston/f0d2eb0bc453bef9faab8d554c14a47c to your computer and use it in GitHub Desktop.
Function cloud send e-mail using firebase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user = event.data.val() | |
var { age, email, grade, name, phone, text, unit } = user | |
const destination = unit === 'Perdizes' ? '[email protected]' : '[email protected]' | |
const to = project === 'batista-webapp' ? destination : '[email protected]' | |
console.log('projeto:', project) | |
var data = { | |
from: '[email protected]', | |
subject: `Contato através do site de ${name}`, | |
html: `<p>A seguinte mensagem de <b>${name}</b> foi enviada através do site:</p><br> | |
<p>Nome: ${name}</p> | |
<p>Email: ${email}</p> | |
<p>Telefone: ${phone}</p> | |
${grade ? '<p>Série: ' + grade + '</p>' : ''} | |
<p>Idade da criança: ${age}</p><br> | |
${text ? '<p>Mensagem: ' + text + '</p>' : ''}`, | |
to | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment