M
M
masimka2018-09-24 14:42:12
Node.js
masimka, 2018-09-24 14:42:12

How to solve Socket timed out error on emailjs-smtp-client?

Greetings fellow colleagues.
There is npm emailjs-smtp-client.
It has emailjs-tcp-socket as a dependency.

There is a project in VUE on the side, everything is assembled by webpack so that everything works in conjunction with VUE on the front.
It causes the following error in the browser:

Uncaught (in promise) TypeError: this.socket.send is not a function
at SmtpClient._send (client.js?00c3:486)
at SmtpClient._sendCommand (client.js?00c3:480)
at SmtpClient.quit (client.js ?00c3:177)
at eval (VM5894 761:276)
at
_send @ client.js?00c3:486
_sendCommand @ client.js?00c3:480
quit @ client.js?00c3:177
fn._withTask.fn._withTask @ vue .esm.js?65d7:1826
VM5894 761:269 Error: Socket timed out!
at SmtpClient._onTimeout(client.js?00c3:419)


tried setting timeouts in emailjs-smtp-client/src/client.js
const TIMEOUT_SOCKET_LOWER_BOUND = 10000
const TIMEOUT_SOCKET_MULTIPLIER = 0.1
nothing helped.

initiating mail client
options = {
                auth: {
                  user: mail.mail,
                  pass: mail.pass,
                  ca: true,
                  ignoreTLS: false,
                  requireTLS: true,
                },
              };
              client = new SmtpClient(mail.host, 587, options);
              client.onidle = () => {
                console.log('Connection has been established');
                if (alreadySending) { return; }
                alreadySending = true;
                client.useEnvelope({
                  from: mail.mail,
                  to: mail.mail,
                });
              };

Through telnet on 587 there is a connection but does not work in all browsers.
In debugger, network in browser websocket connection is empty.
At the beginning, a TypeError error occurs: this.socket.send is not a function, then when the timeout ends, an error occurs at SmtpClient._onTimeout (client.js?00c3:419).
It seems that it works for people, it doesn’t even want to connect with me.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question