TCC-RT sendmail

ron

Aug 19, 2008
151
0
So, using SENDMAIL with TCC-RT. I got it working by creating a .ini with pieces from my Take Command .ini file.

If later someone wants to use the batch file but not my SMTP credentials, how is that done? Without TCMD, there is no way to configure SMTP if all you have is TCC-RT - true?
 
Nov 13, 2008
255
3
www.thedave.me
So, using SENDMAIL with TCC-RT. I got it working by creating a .ini with pieces from my Take Command .ini file.

If later someone wants to use the batch file but not my SMTP credentials, how is that done? Without TCMD, there is no way to configure SMTP if all you have is TCC-RT - true?

I don't believe there is any particular reason you couldn't create your own interface to allow users to configure these settings. For some BTMs I distribute within my own environment, I set some environment variables to sane defaults, then read a local INI which may override certain settings.

I omitted the initial variable sets at the top, and in my case I first run through a computer-wide INI and then second a user-specific INI, hence why %section% is a variable, but you could hardcode this instead. I also did a bit of sanity checking in the past, but I dropped that code as it was simply easier to pass the SMTP error off to the user if needed.

Once I finally have sane settings in varibles, I use a bunch of option // commands to set the settings in the current instance so that I can proceed with sendmail commands.

Code:
if %@len[%@iniread[%mailinipath,%section%,MailAddress]] gt 0 set MailAddress=%@iniread[%mailinipath,%section%,MailAddress]
if %@len[%@iniread[%mailinipath,%section%,MailPassword]] gt 0 set MailPassword=%@iniread[%mailinipath,%section%,MailPassword]
if %@len[%@iniread[%mailinipath,%section%,MailPort]] gt 0 set MailPort=%@iniread[%mailinipath,%section%,MailPort]
if %@len[%@iniread[%mailinipath,%section%,MailServer]] gt 0 set MailServer=%@iniread[%mailinipath,%section%,MailServer]
if %@len[%@iniread[%mailinipath,%section%,MailUser]] gt 0 set MailUser=%@iniread[%mailinipath,%section%,MailUser]
if %@len[%@iniread[%mailinipath,%section%,MailSSL]] gt 0 set MailSSL=%@iniread[%mailinipath,%section%,MailSSL]

option //MailAddress=%MailAddress%
option //MailPassword=%MailPassword%
option //MailPort=%MailPort%
option //MailServer=%MailServer%
option //MailUser=%MailUser%
option //MailSSL=%MailSSL%

You could either instruct users to complete an INI file manually, or prompt the user for settings and write the INI yourself. I don't know for certain whether any of this is limited in TCC-RT or not as I have not personally used TCC-RT at this time.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
... or let your script query the user for the necessary info (if not found in the INI file), setting it for the current instance with OPTION (and optionally saving it in the user's own INI file). Untested:

Code:
iff "%@iniread[%_ininame,4NT,MailServer]" == ""
    input Enter the name of your mail server: %%mailserver
    option /u //MailServer=%mailserver
endiff

Similarly for the other necessary info.
 
So, using SENDMAIL with TCC-RT. I got it working by creating a .ini with pieces from my Take Command .ini file.

If later someone wants to use the batch file but not my SMTP credentials, how is that done? Without TCMD, there is no way to configure SMTP if all you have is TCC-RT - true?

This works for me:
Code:
@setlocal
@echo off
ver /r
iff %_tccrt eq 1 then
  option //MailServer=smtp-mail.outlook.com
  option //MailAddress=userid@outlook.com
  option //MailPort=587
  option //MailUser=userid@outlook.com
  option //MailPassword=Password
  option //MailSSL=Yes
  sendmail /SSL=2 /v 1234567890@msg.telus.com "Hello from TCC-RT"
else
  echo Not running from TCC-RT
endiff
pause
endlocal

Joe
 

ron

Aug 19, 2008
151
0
TCC-RT is intended to be configured by a system with Take Command or TCC.

Meaning I should do what I did - take the configuration pieces needed for my batch file and create an INI with those settings just for TCC-RT? Or is there some other method using TCC I've not found yet?

Thanks everyone else for the examples - I'd not thought about using OPTION - actually never used it before in a script. So TC disguises the email password in the .INI file. Using OPTION I suppose the email password must be not-disguised? Or do you use TC to derive a disguised password and plop that in the btm file?
 
Jul 29, 2016
49
1
Use BATCOMP to compress and encrypt the batch file.

Joe

Realize though that there is a *BIG* weakness with using BATCOMP to encrypt batch files. If you use the LOG command to create a command log, it will log every command, including commands issued from batch files regardless if they've been compressed/encrypted or not. The encryption key must somehow be hard-coded into TCC, as TCC obviously needs to be able to decrypt the batch file (in memory) in order to read the commands that it needs to execute (and also to log in the command log if you've used the LOG command to turn that on).
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
Realize though that there is a *BIG* weakness with using BATCOMP to encrypt batch files. If you use the LOG command to create a command log, it will log every command, including commands issued from batch files regardless if they've been compressed/encrypted or not.

Not true - recent versions of TCC & TCC-RT do *not* log commands if the batch file is compressed.
 
Similar threads
Thread starter Title Forum Replies Date
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
C COMSPEC constantly reset to TCC.EXE Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
C How to? starting TCC/TCMD v25 Support 2
CWBillow TCC and TCMD in Powershell Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
L FTYPE in TCC, less quirky than in cmd.exe Support 3
V Set path permanently from within TCC? Support 3
DrusTheAxe Runaway TCC.exception.log filling drive Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
Joe Caverly tcc.exception.log Support 3
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
vefatica SCRIPT ... TCC disappears Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
Jesse Heines Access Denied errors in TCC 27 Support 9
fpefpe How to? tcc inifile (%_ininame) Support 3
M How to? Black TCC Prompt Support 2
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Jay Sage Extra TCC Tasks Support 6
vefatica Can I turn off the minimize to tray mechanism in TCC? Support 5
N Command execution slows down in TCC Prompt after a while Support 6
R Upgrade TCMD 19 to TCC 26 Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
samintz How to? Is this doable in TCC? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
D TCC tab detaching & restarting Support 3
Ó Recent git output not shown on TCC Support 1
P Kill all other instances of tcc from a btm batch file Support 2
L Using TCC.exe through an SSH connection Support 3
M TCC color issue in ConEmu Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
Alpengreis Python support for 3.8.3 in TCC v26.x? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.01.40 uploaded Support 0
Peter Murschall TCC V26.01.3x Debugging has problems with Alias /R Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 26.0.37 Uploaded Support 0
vefatica TCC waits for Office apps Support 4
Joe Caverly .BAT works in TCC-RT 25, but not in TCC-RT 26 Support 4
M Strange error messages from TCC in FTP copy Support 7
Kachupp Documentation tcc-rt versions Support 1
V Comments from a first-time user (TCC 26) Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 26.0.28 Support 0
C TCC 26 BATCOMP BTM problems? Support 5
E TCC/CMD difference Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT Public Beta RC2 Support 0

Similar threads