totaljs / framework

Node.js framework
http://www.totaljs.com
Other
4.36k stars 452 forks source link

The callback function returns incorrect data or does not work #513

Closed rosbm closed 7 years ago

rosbm commented 7 years ago

Hello.

I use: module FrameworkMail version 2.6.0.

When I use the "send" function and try to get data from a callback to display an error message nothing happens. :(

I specifically sent mail to a non-existent mailbox and did not receive a response about the error.

But not everything is so simple. The framework still gets information from the mail server that the error was and somewhere stores this information (caches).

This situation is observed when sending emails from Yandex.ru mail servers

When I send letters through the mail server mail.ru, then the framework returns a callback with all the contents (error) and for Yandex.ru mail servers and for mail servers mail.ru one-time, apparently from the cache.

petersirka commented 7 years ago

Hi @rosbm, I'll test it today.

petersirka commented 7 years ago

@rosbm which .send() method do you use?

rosbm commented 7 years ago

Yes .send() method

petersirka commented 7 years ago

:-D Which? Mail.send() or message.send()? Can you send me a line of your code with .send() method?

rosbm commented 7 years ago

Here is an example of the send code I'm using:

` var message = new mail.Message(subject, body);

message.to(toMail);

message.from(mail_manager, nameManager); mail.on('error', function (err) { connection.query( query, function(error, result, fields){ if (error === null && result.length!=0){ console.log('send error! lead ID ' + toMailID + '; userID ' + mailManagerID, '; msgId ' + idMsgSubmit); } }); }); message.send(smtp_val, { port: smtp_port, secure: true, user: mail_manager, password: mail_pass }); `

petersirka commented 7 years ago

You have a problem with mail.on('error'), right? I thought that you mean a callback. I'm going to test it.

rosbm commented 7 years ago

Yes problem with mail.on('error').

What is better to use to display error messages: Mail.on('error') or message.callback(fn)?

petersirka commented 7 years ago

Better is to use send with callback. I'll test error within sending and everything works correctly. I will need more info for debugging.

rosbm commented 7 years ago

What mail servers did you test? Gmail?

petersirka commented 7 years ago

Yes and my personal and fake server (there was a timeout error). Can you send me on my email your SMTP server? You don't have to send credentials.

rosbm commented 7 years ago

The error is not explicitly generated by the framework, if I send it from the server: smtp.yandex.ru (SSL port: 465).

Rather, I would say this: an error is generated, but for some reason it does not return to the console.

And when I send mail from this server: smtp.mail.ru (SSL port: 465), I simultaneously receive output to the error console from both the smtp.yandex.ru server (by previous mail sending) and from the server smtp.mail.ru (SSL port: 465).

petersirka commented 7 years ago

Hi @rosbm, I have tested error event and everything works correctly. I can simulate it as you write. Please try to update Total.js version to latest version.

Thank you!

petersirka commented 7 years ago

Any news?