pass text via shell to Sendmail

Sivakatirswami katir at hindu.org
Mon Sep 5 23:12:06 EDT 2005


I want to pipe a multi-part email to sendmail via a shell script

right now I  have this in the script

  # fix endlines to unix and then save to file
   replace numTochar(13) with numTochar (10) in tMsg

# where "tMsg" is a complete properly formatted mult-part HTML email

# the only way I could do this was to write it to a file
# then use "cat"   like this:

   put ($HOME &"/Desktop/temp.txt") into tPath
   put tMsg into url ("binfile:" & tPath)

   # Do shell stuff and send mail
   set the shellcommand to "/bin/sh"
   put "cat " & quote & tPath & quote & " | sendmail -f  
hpi.list at hindu.org " & (fld "to" of cd "staticText")  into tCmd

Unfortunately there is some new security implementation that is only  
allowing 1024 char input via the terminal, that we *think* is causing  
the above script to insert a CRLF very 1024 characters... it appears  
i the final email, plain text part, as a line break and an extra  
space... in the HTML section the line break is ignored, but the extra  
space appears. My sys admin says:

"Issue the same exact shell command but beginning with "sendmail",  
removing the whole first part that begins with "cat". Then pass the  
same message content you are writing to the file out stdout to  
sendmail's stdin."

CAn anyone help me write the shell cmd? I need to pipe the data in  
variable

tMsg

directly into send mail without reading from a file... at least he  
thinks that may solve the problem..

TIA

Sivakatirswami





More information about the use-livecode mailing list