Skip to content

Sendmail.exe is a windows program that's emulates unix sendmail behavior


Notifications You must be signed in to change notification settings


Folders and files

Last commit message
Last commit date

Latest commit



13 Commits

Repository files navigation

Fake sendmail for Windows with TLS v1.2 support

This is a revival of the fake sendmail program by Byron Jones (, if you don't need TLS v1.1 or v1.2 support please use the original version, there is no support available on both versions and they are both not actively maintained.


sendmail.exe is a simple windows console application that emulates sendmail's -t option to deliver emails piped via stdin.

it is intended to ease running unix code that has /usr/lib/sendmail hardcoded as an email delivery means or program's that use the sendmail pipe method, for example as php on windows uses.

it doesn't support deferred delivery, and requires an smtp server to perform the actual delivery of the messages.

I've been using the fake sendmail program for quite a few years, but when using Office 365 smtp servers TLS v1.0 isn't enough any more, they require TLS v1.2, so I tried to recompile the source that Byron Jones included in the release on his site. With a little fiddle and some minor changes I was able to recompile the Delphi 2007 program, in the current community edition of Delphi builder 10.3 (Rio) from Embarcadero. That contains a newer Indy version, that has support for TLS v1.2 and forced TLS v1.1+ in the sendmail code.

To save anybody else the hassle to recompile the fake sendmail from the source code, I made it available on this github site, including the source code, just as the original version is.


  • Download from this github and unzip it's contents to a temp folder on your system

  • copy sendmail.exe, sendmail.ini and both .dll files to \usr\lib on the drive where the unix application is installed. eg. if your application is installed on c:, sendmail.exe and sendmail.ini need to be copied to c:\usr\lib\sendmail.exe and c:\usr\lib\sendmail.ini or an other directory if the path isn't hardcoded in the application that's using it.

  • configure smtp server and default domain in sendmail.ini.


generally all you need to do is install sendmail.exe in \usr\lib, and existing code that calls /usr/lib/sendmail will work.

if you're coding new applications, all you need to do is construct your email message with complete headers, then pipe it to 'sendmail.exe -t'


With PHP the sendmail path isn't hardcoded, it can be configured in the php.ini file, so the sendmail.exe and it's files can be placed together anywhere on the system, the config states "Unix only" for the sendmail_path option, but it works on windows to, it overrides the 3 Win32 only options above it, see the PHP manual (

Note: If your SMTP server doesn't require authentication or encryption, you can just use the SMTP an SMPT_PORT config parameters to specify a smtp server, you don't need sendmail.exe then.


[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.
;sendmail_from =

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:\sendmail\sendmail.exe -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

In the sendmail.ini you specify the smtp server address and the username/password combo


Sendmail sets the ERRORLEVEL to 0 when successful.

Version 28 and higher set the ERRORLEVEL to -1 if the email was unable to be delivered. The value was changed to provide better compatibility with PHP, which expects the ERRORLEVEL to be -1 on failure.


uncomment the debug_logfile entry in sendmail.ini and try to resend a failed message. this should create debug.log in the same directory as sendmail.exe showing the complete SMTP transcript.


Please see the orginial versions site:


This program is released under the bsd license:

The license details and full source code (Delphi 10.3 Rio) are included in the source folder in the zipfile and this repository.


Sendmail.exe is a windows program that's emulates unix sendmail behavior







No releases published