How can I do to send an email with Vuejs2. I manage to get the input data and turned them into json but I can not send them to a mailbox.
I look for the side of PHPMailer but facing PHP and Vue do not mix.
How can I send the form content?
Template :
<div class="JC-contact__form">
<b-form @submit="onSubmit" v-if="show">
<b-form-group class="JC-contact__form--lastName">
<b-form-input type="text" v-model="form.lastName"> </b-form-input>
</b-form-group>
<b-form-group class="JC-contact__form--firstName">
<b-form-input type="text" v-model="form.firstName"> </b-form-input>
</b-form-group>
<b-form-group>
<b-form-input type="text" v-model="form.topic"> </b-form-input>
</b-form-group>
<b-form-group>
<b-form-input type="email" v-model="form.email"></b-form-input>
</b-form-group>
<b-form-textarea v-model="form.text"></b-form-textarea>
<b-button type="submit">Envoyer</b-button>
</b-form>
</div>
Script :
export default {
name: 'Contact',
data () {
return {
form: {
lastName: '',
firstName: '',
topic: '',
email: '',
text: ''
},
file: null,
show: true
}
},
methods: {
onSubmit (evt) {
evt.preventDefault();
alert(JSON.stringify(this.form));
},
onReset (evt) {
evt.preventDefault();
/* Reset our form values */
this.form.lastName = '';
this.form.firstName = '';
this.form.topic = '';
this.form.email = '';
this.form.text = '';
/* Trick to reset/clear native browser form validation state */
this.show = false;
this.$nextTick(() => {
this.show = true
});
}
}
}