Home > Mobile >  SMTP JS Not Working With No Errors (Vanilla JavaScript)
SMTP JS Not Working With No Errors (Vanilla JavaScript)

Time:08-12

SMTP JS has stopped working for me on my signup page on my website. My email server is Elastic Email. There are no signs of any SMTP JS data in my activity inbox.

Below is my email sending javaScript the idea is when the variable studentSignup is = to 1 Than this code will run:

       if (signupStudents === 1) {
    
        var send = function() {
    Email.send({
    Host : "smtp.elasticemail.com",
    Username : "[email protected]",
    Password : "9401A8928B5701CCC4891E79E0CBF1B61C8582CA91F8769DC1A056AF9A85393F3B8A8AEA34C86A198C54EC677A3440B0",
    To : '[email protected]',
    From : "[email protected]",
    Subject : "New Intermdite Signup",
    Body : "Parent Name "   document.getElementById ("parent-name"),
}).then(
    window.location.replace("/sucuss.html"),
);
};

}

Otherwise this will happen:

else {
    var send = function() {
    Email.send({
    Host : "smtp.elasticemail.com",
    Username : "[email protected]",
    Password : "CBFAA2D72FF7E206C34F23FA8A131EA2D275",
    To : '[email protected]',
    From : "[email protected]",
    Subject : "New Intermdite Signup",
    Body : "Parent Name "   document.getElementById ("parent-name")   "yay"
}).then(
    window.location.replace("/sucuss.html"),
);
};
}

You can see all the website code in the code snippet.

 var newStudentBtn = document.getElementById ("new-student");
        var students = document.getElementById ("students");
        var signupStudents = 1;
        var cost = document.getElementById ("cost");
        var confirmedStudents = "'test'"
        var studentNamesCode;
        
        let ids = new Object ();
        ids.idNames = "";
        ids.getInfo = function () {
            return this.idNames;
        };


        
        var newStudentBtnOnClick = function () {
            signupStudents  ;
            let newStudent = document.createElement ("input");
            newStudent.placeholder="Type your child's first and last name here";
            newStudent.id = "signup-students-input"   signupStudents;
            
            let newStudentHeading = document.createElement ("h3");
            let studentNewLine = document.createElement ("br");
            newStudentHeading.innerHTML = "Child ("   signupStudents   ") First and Last Name";
            students.appendChild (newStudentHeading)
            students.appendChild (newStudent);
            
            cost.innerHTML = signupStudents*39
            if (signupStudents > 2) {
            ids.idNames  = "   'Student('   signupStudents   ')'   document.getElementById ('"   newStudent.id   "').value ";
            }
            else {
                ids.idNames  = "confirmedStudents   document.getElementById ('"   newStudent.id   "').value ";
            }

            studentNamesCode = eval(ids.getInfo());
           
            console.log (ids.getInfo())
            console.log (studentNamesCode) 

            
        };

        newStudentBtn.addEventListener ("click", newStudentBtnOnClick);

      

       if (signupStudents === 1) {
    
        var send = function() {
    Email.send({
    Host : "smtp.elasticemail.com",
    Username : "[email protected]",
    Password : "9401A8928B5701CCC4891E79E0CBF1B61C8582CA91F8769DC1A056AF9A85393F3B8A8AEA34C86A198C54EC677A3440B0",
    To : '[email protected]',
    From : "[email protected]",
    Subject : "New Intermdite Signup",
    Body : "Parent Name "   document.getElementById ("parent-name"),
}).then(
    window.location.replace("/sucuss.html"),
);
};

}

else {
    var send = function() {
    Email.send({
    Host : "smtp.elasticemail.com",
    Username : "[email protected]",
    Password : "CBFAA2D72FF7E206C34F23FA8A131EA2D275",
    To : '[email protected]',
    From : "[email protected]",
    Subject : "New Intermdite Signup",
    Body : "Parent Name "   document.getElementById ("parent-name")   "yay"
}).then(
    window.location.replace("/sucuss.html"),
);
};
}
<script src="https://smtpjs.com/v3/smtp.js"></script>
    <div >
        <nav>
            <a href="index.html"><img src="img_2.jpg" ></a>
            <div >
                <button >About Us</button>
                <button >Classes</button>
                <button >Contact Us</button>
            </div>
        </nav>
    </div>
    <div >
        <h1>Signup for the Intermedite Class</h1>
    </div>
    <div >
        <div ><h2>Please fill out the form</h2></div>
       
        <div >
            <form onsubmit="send(); reset(); return false;">
                <div id="students">
            <h3>Parent First and Last Name</h3>
            <input placeholder="Type your first and last name here" required id="parent-name">
            <h3>Child (1) First and Last Name</h3>
            <input placeholder="Type your child's first and last name here" required >
        </div>
            
        <br><br><button  id="new-student" type="button">New Student</button><br><br>
            <h3>Parent Email Address</h3>
            <input placeholder="Type your email address here" required>
            <h3>Parent Phone Number (For Emgerency Contact Only)</h3>
            <input placeholder="Type your phone number here" required>
            <p>Please pay $<span id="cost">39</span> cash after your childs first class.</p>
            <button  type="submit">Enroll</button>

</form>
        </div>
        
        
    </div>
    </div>

CodePudding user response:

I have had the same problem since the end of July. Requests using SMTPJS time out without an error code or any response.

CodePudding user response:

I also have faced this issue. I firstly tried to regenerate my secure token via https://smtpjs.com/ but received this error:

'Port 2525 on smtp.elasticemail.com is not open'

I then reached out to ElasticEmail support and they responded:

"Please be informed that we've received several similar reports. It seems that there is an issue with SmtpJS. Our Developers are looking into this. We will get back to you as soon as possible. Thank you for your patience."

So it would seem that it may be an issue on their end.

  • Related