nodemailer / smtp-server

Create custom SMTP servers on the fly
Other
846 stars 145 forks source link

SMTP Server Capturing and Storing Old Emails Unintentionally #196

Closed Harmish-Babariya closed 10 months ago

Harmish-Babariya commented 10 months ago

Issue Overview: I am encountering an unexpected behavior with my SMTP server where it is capturing and storing old emails, even though the server is not configured to retain any email data. The server's primary purpose is to handle incoming emails and process them based on standard SMTP behavior. However, it appears that the server is unintentionally capturing emails from the past.

Issue Details: My SMTP server is set up to handle incoming emails using standard configurations and libraries. I have not implemented any custom logic for capturing or storing emails in the server code. Despite the absence of any intentional data storage mechanism, the server is retaining emails that were sent before the server's current runtime session.

Steps Taken: I have reviewed the server code to ensure that there are no explicit mechanisms for capturing or storing emails. I have tested the server's behavior by sending test emails from different sources and timestamps. The server consistently captures and retains emails sent prior to the current server session.

Expected Behavior: The SMTP server should only process incoming emails based on standard SMTP behavior and should not capture or store emails that were sent before the server's runtime session.

Request for Assistance: I am raising this issue to seek assistance from the community in understanding why my SMTP server is capturing and storing emails unexpectedly. If anyone has encountered a similar issue or has insights into potential causes, I would greatly appreciate your input.

I apologize for any confusion. Based on your clarification, if you're facing an issue with your SMTP server capturing old emails unexpectedly, here's a suggested title and description for raising the issue on GitHub:

Title: SMTP Server Capturing and Storing Old Emails Unintentionally

Description: Issue Overview: I am encountering an unexpected behavior with my SMTP server where it is capturing and storing old emails, even though the server is not configured to retain any email data. The server's primary purpose is to handle incoming emails and process them based on standard SMTP behavior. However, it appears that the server is unintentionally capturing emails from the past.

Issue Details:

My SMTP server is set up to handle incoming emails using standard configurations and libraries. I have not implemented any custom logic for capturing or storing emails in the server code. Despite the absence of any intentional data storage mechanism, the server is retaining emails that were sent before the server's current runtime session. Steps Taken:

I have reviewed the server code to ensure that there are no explicit mechanisms for capturing or storing emails. I have tested the server's behavior by sending test emails from different sources and timestamps. The server consistently captures and retains emails sent prior to the current server session. Expected Behavior: The SMTP server should only process incoming emails based on standard SMTP behavior and should not capture or store emails that were sent before the server's runtime session.

Request for Assistance: I am raising this issue to seek assistance from the community in understanding why my SMTP server is capturing and storing emails unexpectedly. If anyone has encountered a similar issue or has insights into potential causes, I would greatly appreciate your input.

I'm looking forward to any suggestions or feedback that can help me identify and resolve this unexpected behavior in my SMTP server.

Thank you for your time and assistance.

Best regards, Harmish Babariya

Feel free to modify the title, description, and contact information to match your context. This issue description highlights the unexpected behavior of capturing and storing old emails in a standard SMTP server and requests assistance from the community to troubleshoot and find a solution.

andris9 commented 10 months ago

Just like express.js can not provide you "http requests from the past", smtp-server can not provide you with emails from the past. smtp-server is just a protocol handler, nothing else.

Harmish-Babariya commented 10 months ago

It capturing past email. when i start server (node server.js), it is stable. Then i sent one email from gmail and then email is received by server done. After that it starting capturing old email (also yesterday mail that i sent to my server ) and also capture current email more times

andris9 commented 10 months ago

Sounds like a bug in your code. Make sure you are not calling the callback function multiple times etc.

Harmish-Babariya commented 10 months ago

SMPT server code: const SMTPServer = require("smtp-server").SMTPServer; const simpleParser = require("mailparser").simpleParser;

const server = new SMTPServer({ logger: true, onData(stream, session, callback) { simpleParser(stream, {}, (err, parsed) => { if (err) { console.log("Error:", err); return callback(err); } console.log(parsed); stream.on("end", callback); }); }, disabledCommands: ['AUTH'] });

server.listen(25);

andris9 commented 10 months ago

There is absolutely no way this code retriggers old messages by itself

Harmish-Babariya commented 10 months ago

How can I prove that it recapture old email even yesterday email ? By just one new current email, it starting capturing old email 😄.

andris9 commented 10 months ago

I'd suggest turning logging on for smtp-server logger: true, debug: true, maybe adding some debug breakpoints or printing info to the console etc., and then going through that information to find clues of what is going on. Currently, there is no way I believe the smtp-server is capturing old emails by itself without actual proof and reasoning of how and why it would do so.

Harmish-Babariya commented 10 months ago

I know smtp server just accepting the connection from other host like as in my case Gmail. But from one connection it trigger other connections from Gmail and starting accepting email(old). I can guess that this is Gmail issue. But If it is , then we don't receive duplicate mail in our Gmail. I don't know what's happening.