I am developing a project with vue.js so to manage sending email throught contact form insted of the backend I um using Email.js I followed steps as below:
- Add an email services
- Create an email template
- install emailjs
- create contact form
I hosted inthenetlify server problem is the sending email works on local host and in the permalink on the etlfiybut no in the production deply:
Anyone haveany idea way the emailjs works proplery in the localhost and in the permalinkf but not in tproduction deply?
This is my contat form:
<template> <form class="contact-form" @submit.prevent="submitForm"> <div class="form-row"> <input type="text" placeholder="Emri" v-model="form.name" required /> <input type="text" placeholder="Mbiemri" v-model="form.surname" required /> </div> <input type="email" placeholder="Emaili" v-model="form.email" required /> <input type="tel" placeholder="Numri i telefonit" v-model="form.phoneNumber" required /> <textarea placeholder="Mesazhi juaj..." v-model="form.message" required></textarea> <label class="form-checkbox"> <input type="checkbox" id="agree" v-model="form.agree" required /> <span class="checkmark"></span> Unë pajtohem me politikën e privatësisë </label>
<button type="submit">Dërgo mesazhin</button> </form> </template>
<script> import emailjs from 'emailjs-com';
export default { data() { return { form: { name: '', surname: '', email: '', phoneNumber: '', message: '', agree: false } }; }, methods: { submitForm() { if (!this.form.agree) {
alert('Ju duhet të pajtoheni me politikën e privatësisë.'); return; } emailjs.init('oLZFwveHWcVav2XXR');
const templateParams = { from_name:
${this.form.name} ${this.form.surname}
, from_email: this.form.email, phone: this.form.phoneNumber, message: this.form.message }; emailjs.send( 'service_xy79spl',
'template_s9oxbl4',
templateParams, 'oLZFwveHWcVav2XXR'
).then(() => { alert('Mesazhi u dërgua me sukses!'); this.resetForm(); }).catch((error) => { console.error('Gabim gjatë dërgimit:', error); alert('Ndodhi një gabim gjatë dërgimit.'); }); }, resetForm() { this.form = { name: '', surname: '', email: '', phoneNumber: '', message: '', agree: false }; }}
}; </script>
i tried to check if the email Services, Email template, Account has done OK or maybe has any mistake but there are configuration ok.