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.
it doesn't support deferred delivery, and requires an smtp server to perform the actual delivery of the messages.
unfortunately i no longer have the time or resources to provide any support or updates to sendmail.
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 /usr/lib/sendmail -t
for example, to use fake sendmail from the command line:
@ECHO OFF REM send email from command line via SMTP with sendmail ECHO From: email@example.com > %TEMP%\temp.mail ECHO To: firstname.lastname@example.org >> %TEMP%\temp.mail ECHO Subject: this is a test >> %TEMP%\temp.mail ECHO.>> %TEMP%\temp.mail ECHO testing. >> %TEMP%\temp.mail ECHO blah blah.. >> %TEMP%\temp.mail ECHO. >> %TEMP%\temp.mail ECHO blah. >> %TEMP%\temp.mail sendmail -t < %TEMP%\temp.mail DEL %TEMP%\temp.mail
note ECHO. puts a blank line in the file, not a line with a single period on it.
note: if you have IIS installed, you can send emails without any third party programs (you do NOT need my sendmail wrapper).
@ECHO OFF REM send email from command line via IIS REM change this path to point to IIS's pickup directory SET root=c:\InetPub\MailRoot\Pickup REM set up temp and eml filenames IF NOT EXIST %root%\temp MKDIR %root%\temp :setTempFileName SET tmp=%RANDOM% IF EXIST %root%\temp\%tmp%.tmp GOTO setTempFileName SET eml=%root%\%tmp%.eml SET tmp=%root%\temp\%tmp%.tmp REM build the email. ^ is the escape character ECHO From: email@example.com> %tmp% ECHO To: firstname.lastname@example.org>> %tmp% ECHO Subject: Example>> %tmp% ECHO Content-Type: text/html>> %tmp% ECHO.>> %tmp% ECHO ^<b^>This is a test^</b^>>> %tmp% REM move the temp file into the pickup directory for delivery RENAME %tmp% %eml%
msmtp is an excellent open-source sendmail replacement.
while it's possile to send email from the command line or a batch file using fake sendmail, blat is a fantastic open-source utility which will allow you to easily send emails with attachments.
i've had a few reports of sendmail returning a "range check error". i have tracked this to a bug in the indy sockets library and it has been fixed in version 18.
some anti-virus products limit what applications are allowed to send mail via port 25 (SMTP). ensure that sendmail.exe is in your list of approved applications.
socket error 11004 means that the dns server which sendmail is talking to does not have a record of the appropriate type for the com puter name which it was looking up.
this can happen if the dns server is currently incorrectly configured (check with your isp, or whoever is running the dns server you are using) or because you should be using a different computer name which would have an a record defined.
in some cases it can also happen because you are using the incorrect dns server addresses (eg using the dns servers of one isp when you are dialing into a second isp).
it means that you have been denied access to that smtp server by its administrator. administrators prevent abuses of their smtp relay servers by requiring that you send e-mail only from a computer connected to their network, or that you use some type of authentication.
talk to the server's administrator and ask what are the requirements for connecting to the server. sometimes, the server may need to be reconfigured.
http://stackoverflow.com/q/21337859 details a workaround for this which involves running sendmail.exe in "windows xp sp 3" compatibility mode as administrator.
sendmail sets the ERRORLEVEL to 0 when successful.
versions prior to version 28 set the ERRORLEVEL to 1 if the email was unable to be delivered.
version 28 and high 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. should you require an updated version which sets the ERRORLEVEL to 1, don't hesitate to let me know.
uncomment the debug_logfile entry in sendmail.ini resend a failed message. this should create debug.log in the same directory as sendmail.exe showing the complete SMTP transcript.
this program is released under the bsd license.
the license details and full source (delphi 2007) are included in the zip.
version 32 (18 june 2011) - fix handling of invalid recipients version 31 (15 sep, 2010) - fix encoding of 8-bit data version 30 (30 aug, 2010) - update to latest indy version (fixes many issues) - add about/version version 29 (sep 8, 2009) - fix for another indy 10 "range check error" (when using ssl) version 28 (aug 12, 2009) - set ERRORLEVEL to -1 to assist php version 27 (aug 3, 2009) - don't treat log write errors as fatal version 26 (apr 1, 2009) - no longer require -t parameter - skip first line if it starts with "from " (mail spool delimiting line) version 25 (mar 29, 2009) - added force_recipient version 24 (dec 2, 2008) - fixes for ssl version 23 (apr 24, 2008) - fix timezone in date header version 22 (jan 14, 2008) - fixes to error handling version 21 (jan 2, 2008) - added TLS support version 20 (apr 3, 2007) - fixed race condition in IIS's pickup delivery version 19 (jul 24, 2006) - added support for delivery via IIS's pickup directory - optionally reads settings from the registry (in absense of the ini file) version 18 (may 1, 2006) - fix for indy 10 "range check error" version 17 (nov 2, 2005) - only process message header - optionally use madexcept for detailed crash dumps version 16 (sep 12, 2005) - send hostname and domain with HELO/EHLO - configurable HELO/EHLO hostname - upgraded to indy 10 version 15 (aug 23, 2005) - fixes error messages when debug_logfile is not specified version 14 (jun 28, 2005) - errors output to STDERR - fixes for delphi 7 compilation - added 'connecting to..' debug logging - reworked error and debug log format version 13 (jun 8, 2005) - added fix to work around invalid multiple header instances version 12 (apr 30, 2005) - added cc and bcc support version 11 (feb 17, 2005) - added pop3 support (for pop before smtp authentication) version 10 (feb 11, 2005) - added support for specifying a different smtp port version 9 (sep 22, 2004) - added force_sender version 8 (sep 22, 2004) - *really* fixes broken smtp auth version 7 (sep 22, 2004) - fixes broken smtp auth version 6 (sep 22, 2004) - correctly quotes MAIL FROM and RCPT TO addresses in <> version 5 (sep 16, 2004) - now sends the message unchanged (rather than getting indy to regenerate it) version 4 (aug 17, 2004) - added debug_logfile parameter - improved error messages version 3 (jul 15, 2004) - smtp authentication support - clearer error message when missing from or to address - optional error logging - adds date: if missing version 2 (jul 6, 2004) - reads default domain from registry (.ini setting overrides) version 1 (jul 1, 2004) - initial release