New Jun 30, 2025

Way configuration of the Emailjs works in the localhost but in the production does not work

Libraries, Frameworks, etc. All from Newest questions tagged vue.js - Stack Overflow View Way configuration of the Emailjs works in the localhost but in the production does not work on stackoverflow.com

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:

  1. Add an email services
  2. Create an email template
  3. install emailjs
  4. 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:enter image description here 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.

Scroll to top