by Davide » Wed Dec 31, 2008 12:21 pm
******************************************************************
Function SendMail(cNameFrom,cFrom,cNameTo,cTo,cBcc,cSubject,cText)
******************************************************************
Local cTxt
If Empty(cNameFrom) ; cNameFrom:="" ; Endif
If Empty(cFrom) ; cFrom :="info@you.com" ; Endif
If Empty(cNameTo) ; cNameTo :="" ; Endif
If Empty(cTo) ; cTo :="info@you.com" ; Endif // It should never happen
If Empty(cBcc) ; cBcc :="" ; Endif
If Empty(cText) ; cText :="" ; Endif
If Empty(cSubject) ; cSubject :="Request from "+HB_ARGV(0) ; Endif
cTxt:="From: "+chr(34)+cNameFrom+chr(34)+" <"+cFrom+">"+chr(10)+;
"To: "+chr(34)+cNameto+chr(34)+" <"+cTo+">"+chr(10)+;
"Subject: "+cSubject+chr(10)+chr(10)+cText
cTxt:=StrTran(cTxt,"'",chr(96))
cTxt:="echo '"+cTxt+"' | /usr/sbin/sendmail -f "+cFrom+" "+cTo+" "+cBcc
RUN ( cTxt )
Return cTxT