Lparameters tlCritical LOCAL lcDll, lcCmd, lnResult Local lcRecipients, lcErrorEmail Local lcSMTPServer Local liCurrentLevel Local liLevel Local lcSubject Local lcLogEntry If Pcount() = 0 tlCritical = .f. Else If Vartype( tlCritical) <> "L" tlCritical = .f. endif Endif lcRecipients = ThisForm.oIni.GetIniEntry( "Main", "EmailTo", ThisForm.cIniFile) lcSMTPServer = ThisForm.oIni.GetIniEntry( "Main", "SMTPServer", ThisForm.cIniFile) lcDll = ThisForm.cAppPath + "\blat.dll" DECLARE INTEGER Send IN (lcDll) STRING blatstring * Prepare message body lcErrorEmail = "Hello, " + CRLF ; + CRLF ; + "The following is information related to the creation of the radar.web update on " ; + Dtoc( Date()) + " at "+ Alltrim( Time()) + ":" + CRLF ; + CRLF ; + "Message: " + ThisForm.oResult.Message + CRLF ; + "Offending code (if any): " ; + CRLF ; + ThisForm.oResult.LineContents + CRLF + CRLF + CRLF ; + CRLF + CRLF ; + "Call stack: " + CRLF + CRLF For liLevel = 1 To Program( -1) lcErrorEmail = lcErrorEmail + Program( liLevel) + CRLF Next lcErrorEmail = lcErrorEmail + CRLF + CRLF ; + CRLF + CRLF ; + "End of message." StrToFile( lcErrorEmail, ThisForm.cAppPath + "\email.txt") * I want the subject to change from one message to another so that gmail doesn't clump them together. lcSubject = "RACWeb information " + Left(Dtos(Date()), 8) + "-" ; + right( Ttoc( Datetime(), 1), 6) lcCmd = ["] + ThisForm.cAppPath + [\email.txt" -s "] + lcSubject + [" -t ] + lcRecipients ; + [ -server ] + lcSMTPServer + [ -f RacWebUpdate@record-access.com] ; + [ -log "] + ThisForm.cAppPath + [\blat.log" -superdebugT] lnResult = Send(lcCmd) lcLogEntry = "Command: " + lcCmd + CRLF + CRLF + Replicate( "-", 60) + CRLF ; + "Message: " + Filetostr( ThisForm.cAppPath + "\email.txt") + CRLF + CRLF + Replicate( "-", 60) ; + CRLF ; + "Result code: " + Alltrim( Str( lnResult)) + CRLF ThisForm.log.new( "Email sent to " + lcRecipients, lcLogEntry) If tlCritical * The error was of a critical nature. The app must be shut down. Wait "Closing application in 10 seconds" Window Noclear Timeout 10 Thisform.Release() Endif * Now that the error has been emailed. Clear the contents of the oResult properties. ThisForm.oResult.errorno = 0 ThisForm.oResult.message = "" ThisForm.oResult.Comment = "" Return .t.>Alex,