Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function envoyerMessage(){
- let emailInput = document.getElementById('formMailAdress').value;
- let usernamInput = document.getElementById('formMailAdress').value;
- let messageInput = document.getElementById('formMessage').value;
- var data = {
- service_id: 'service_uhiriw7',
- template_id: 'template_vfhno4w',
- user_id: 'user_RgWgV8UKpxFtbjbgABShp',
- template_params: {
- 'username': emailInput,
- 'to_name': emailInput,
- 'from':'samirbenjalloul@gmail.com',
- 'message': messageInput,
- }
- };
- $.ajax('https://api.emailjs.com/api/v1.0/email/send', {
- type: 'POST',
- data: JSON.stringify(data),
- contentType: 'application/json'
- }).done(function() {
- // alert('Your mail is sent!');
- Swal.fire({
- icon: "success",
- title: "Success...",
- text: "Mail bien envoyé !!",
- });
- }).fail(function(error) {
- // alert('Oops... ' + JSON.stringify(error));
- Swal.fire({
- icon: "error",
- title: "Oops...",
- text: "Erreur hmmmmm.... ???",
- });
- });
- }
Add Comment
Please, Sign In to add comment