Hi Guys,
I´m working in a form that i collect a *.kml from the costumer and after the form is filled send a email for me and for the costumer with a link of that kml that he wrote on the form.
All of my form is right and work well, but when i receive the email with the form answers including the url, so by clicking on the url open other page with the “Forbidden” message.
Someone know how to fix it?
URL received http://docs.wixstatic.com/ugd/9d239c_d84e093afd0e4a609f5097318fdc6e29.kml?dn=formulario.kmlcode:
import {sendEmail,sendEmailWithRecipient} from ‘backend/email’ ;
$w.onReady( function () {
$w( “#dsFormularioBD” ).onAfterSave(sendFormData);
});
function sendFormData() {
//coletar arquivo enviado pelo usuário e enviar por link no formulario e email
const convertRegex = new RegExp(/wix:document://v1/([^/]+)/(.*)$/);
const item = $w( “#dsFormularioBD” ).getCurrentItem();
const matches = item.arquivo.match(convertRegex);
const documentUrl = docs.wixstatic.com/ugd/${matches[ 1 ]}?dn=${matches[ 2 ]}
;
//formulario correto
const subject = Formulario preenchido por: ${$w( "#tbNome" ).value}
;
const body = Data: ${$w( "#tbData" ).value} \rNome: ${$w( "#tbNome" ).value} \rSobrenome: ${$w( "#tbSobrenome" ).value} \rE-mail: ${$w( "#tbEmail" ).value} \rTelefone: ${$w( "#tbTelefone" ).value} \rNome da Empresa: ${$w( "#tbEmpresa" ).value} \rNome da Instituição: ${$w( "#tbNomInst" ).value} \rNome Treinamento: ${$w( "#ddTreinamento" ).value} \rTipo de Serviço: ${$w( "#tbServicos" ).value} \rMarca Equipamento: ${$w( "#ddMarcaEquipamento" ).value} \rModelo Equipamento: ${$w( "#ddItemEquipamento" ).value} \rMensagem: ${$w( "#tbMensagem" ).value} \rArquivo: ${documentUrl}
;
const recipient = $w( “#tbEmail” ).value;
sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));
sendEmail(subject, body)
.then(response => console.log(response));
}