Threat Level: green Handler on Duty: Xavier Mertens

SANS ISC: CVTWIN: Wrestling with SNDMAIL CVTWIN: Wrestling with SNDMAIL

Sign Up for Free!   Forgot Password?
Log In or Sign Up for Free!

Read this if you need to interface closer with sndmail for whatever reason. For instance, your email server refuses email operations from CVTWIN because it requires authorization. Most email servers do not require this, but a few do and this document describes how to pass the additional parameters to the sndmail.dll that CVTWIN uses for sending email. Or if you are still having problems sending email with CVTWIN and have tried all the things in the CVTWIN Troubleshooting section.

CVTWIN uses sndmail.dll for email operations. It also creates SENDIT.BAT, which invokes sndmail.exe, which is the command line version of sndmail.dll. Use SENDIT.BAT to debug problems with sndmail. Meaning that you would edit SENDIT.BAT and then run it from an MS/DOS command line. This is more illuminating than trying to debug sndmail problems from CVTWIN, because CVTWIN might not display all the relevant sndmail error messages.

Configure CVTWIN from the GUI. Fill in all the fields in the configuration dialog. Stop cvtwin.

Then change in cvtwin.ini to be your own email address (so the tests will come to you.) Now start CVTWIN and do a coversion. (When you are done testing, make sure to change toaddr= back to in cvtwin.ini.)

Then open an MS/DOS prompt and change to c:\Program Files\CVTWIN and examine sendit.bat. Note the sndmail variables in sendit.bat. Run sendit.bat and note the error messages

CVTWIN 1.0.83, and newer allows you to set the sndmailParms variable in cvtwin.ini to pass additional parameters to sndmail. This was targeted to users that need to do authentication. See the -h, -u, and -p paramaters, below. If your mail server requires authentication then set these paramaters in cvtwin.ini like

sndmailParms=-h LOGIN -u your_user_name -p your_password

Save it and do another conversion with cvtwin. Examine sendit.bat to see if the parameters you set with snemailParms are now set in sendit.bat. If so, then run sendit.bat. If it works, then sending mail with CVTWIN should also work now, because it uses the same logic in passing parameters to sndmail.dll as it writes to sndmail.bat

Follow the same procedure for debugging other problems with sndmail. If you find that you can send mail by changing parameters in sendit.bat in a way that CVTWIN can't do, then please send all particulars to so that

we can incorporate this in cvtwin. Thanks.

When you are done testing, make sure to change toaddr= back to in cvtwin.ini. If you have followed the above advice to first change it to be your own email address.

Note. CVTWIN creates SENDIT.BAT but does not use it to send email. CVTWIN interfaces directly with sndmail.dll. SENDIT.BAT was created purely to aid debugging, because, well, there are a lot of different mail servers and it is difficult to anticipate all the ways that a program can interface with a given mail server. Running SENDIT.BAT from an MS/DOS command prompt is the best way to find out why sndmail isn't working. But (hopefully!) most users won't need to be wrestling with this, because CVTWIN's email operations will work out of the box.

But if you get stumped and sendit.bat works but you can't get cvtwin to send mail with sndmail.dll, you can configure CVTWIN to use sendit.bat to send mail.

README.TXT file from sndmail

			< SMTP mail delivery agent >

Version      :	2.4
Release type :	Gnu Lesser General Public License
Date         :	14-07-2003
Project by   :	"Davide Libenzi"	

	This software can be used either as command line executable or
	as DLL loaded by a LoadLibrary() - GetProcAddress().

	Use : SndMail  -bsfr  [-DXPFcERSa]

	-b file            Set mail body filename
	-s subject         Set mail Subject
	-f from            Set mail From
	-r rcpt            Add mail Rcpt
	-H                 Treat body file as html
	-D domain          Set HELO domain { SndMail }
	-X server          Set SMTP server { localhost }
	-P port            Set SMTP port { 25 }
	-F formext         Set extended From { from }
	-R reply           Set Reply-To { void }
	-S sender          Set Sender { void }
	-c cc              Add Cc { void }
	-B bcc             Add Bcc { void }
	-t tag             Add mail tag ( Ie. \"TagName: TagValue\" )
	-a atchfile        Add attach file { void }
	-h auth            Set auth type ( PLAIN LOGIN CRAM-MD5 ) { void }
	-u user            Set user name for auth { void }
	-p password        Set password ( or CRAM-MD5 secret ) for auth { void }

Use a different program to send mail

If you've tried everything and can't get CVTWIN to send mail using the internal sndmail.dll method, you can tell CVTWIN to use an external program to send mail. One likely example, is SENDIT.BAT, the DOS version of SndMail.dll (above.)

To tell CVTWIN to use SENDIT.BAT to send mail, add


to C:\Program Files\cvtwin\cvtwin.ini

This will also work if you are running CVTWIN from the Task Scheduler, using the "noui" option.

Important: One bit of trickiness if you use the MailProg variable but don't use sendit.bat is that sendit.bat is created by CVTWIN after each conversion. The last line in sendit.bat copies the timestamp of the last valid log line to 'logdate.txt' CVTWIN compares against this timestamp so that it won't send in lines that have already been sent in. If you use something other than sendit.bat to send mail, your program (or batch file) must also write the most recent valid timestamp to logdate.txt

CVTWIN creates "timestamp.txt" that you can copy into 'logdate.txt' (CVTWIN creates 'timestamp.txt' after each conversion. But this timestamp shouldn't be written to 'logdate.txt' until after the log has actually been emailed. So this must be done as part of sending email, not as part of the log conversion.)

Usage of the 'MailProg' variable and creating timestamp.txt was added in CVTWIN v 1.1.75. This won't work with earlier versions of CVTWIN.

-nomail command line argument

You can use the -nomail command line argument to suppress CVTWIN from sending mail when you are also using the -noui option (usually to run on the Task Scheduler.) If you use this, CVTWIN will convert the log but will not attempt to mail it. You'd use this if CVTWIN's internal sndmail.dll procedure didn't work, and the sendit.bat procedure and "MailProg" variable procedure, above, also didn't work for you.

Example. Say you have "mymail.bat" that works to email the converted log (dlog.txt.) A sample batch file could be

Rem Must always change to the directory that CVTWIN is installed in.
cd "C:\Program Files\cvtwin"

Rem Run CVTWIN with no User Interface and not sending the log as email
cvtwin -noui -nomail

Rem Run my own mail program

Rem So that CVTWIN will know the timestamp of the last log line that
Rem was processed.
copy /y timestamp.txt logdate.txt

This is simplfied and has no error checking. You shouldn't copy timestamp.txt on top of logdate.txt unless you are sure that the mail operation actually completed. (Above.)

Notes: -nomail was added to CVTWIN 1.1.86. -nomail will have no effect if -noui isn't also used.