Malpit acts as a local SMTP server, intercepting and holding emails sent during development, preventing them from reaching real recipients. This allows developers to test emails in a safe, controlled environment.