Emails are not being sent from a mobile phone.... #184
Replies: 4 comments 1 reply
-
It is not known how your HTML code is written, but you should use the "submit" event of the form instead of the "click" on the button. |
Beta Was this translation helpful? Give feedback.
-
Hello xrOmaster!
|
Beta Was this translation helpful? Give feedback.
-
And my js code: const btn = document.getElementById('btn');
const out = document.getElementById('out');
btn.addEventListener('click', hendler);
document.getElementById('cle').addEventListener('click', ()=>{
out.innerHTML = '';
});
function hendler() {
out.innerHTML += 'Hellow!! '+ name.value;
};
document.getElementById('tfp').addEventListener('submit', sendLetters);
function sendLetters(e) {
e.preventDefault();
(function(){
emailjs.init({
privateKey: "p4KEd1Wle5A0F1P--jFoi",
// publicKey: "m9RVUzkB47FrceFE7",
});
})();
const form = document.forms.formpost;
/*const name = form.elements.name.value;
const phone = form.elements.phone.value;
if(!name || !phone) {alert('return'); return;}
const sendPar = {
name: name,
tel: phone
};*/
emailjs.sendForm('service_c8m3cj4', 'template_7ev8v6q', form, this).then(
(response) => {
console.log('SUCCESS!', response.text);
},
(error) => {
console.log('FAILED...', error.text);
},
);
} In console: |
Beta Was this translation helpful? Give feedback.
-
I tried both with and without the 4th parameter, and with "error.text" and with "error".... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
The next problem:
Emails are not being sent from a mobile phone....
my code:
`document.getElementById('bttfp').addEventListener('click', sendLetters);
function sendLetters(e) {
e.preventDefault();
(function(){
emailjs.init({
privateKey: "p4KEd1Wle5A0F1P--jFoi",
publicKey: "m9RVUzkB47FrceFE7",
});
})();
const form = document.forms.formpost;
emailjs.sendForm('service_c8m3cj4', 'template_7ev8v6q', form, this).then(
(response) => {
console.log('SUCCESS!', response.text);
},
(error) => {
console.log('FAILED...', error);
},
);
}`
It outputs to the console: FAILED.... undefined... and the email is not being sent.... What should I do???
Beta Was this translation helpful? Give feedback.
All reactions