AnsweredAssumed Answered

Server Side Email Script is  Mysteriously Failing (Error Code 1506)

Question asked by BreitenbushIT on Jun 26, 2010
Latest reply on Jul 20, 2010 by BreitenbushIT

Title

Server Side Email Script is  Mysteriously Failing (Error Code 1506)

Your post

I am completely baffled by this one.   :)

 

I am running FMSA 11 on a Mac with OS 10.6.2 installed.  I have a server side script that runs throughout the day (every 30 minutes) which checks a database to see if there are any records that contain a flag that the record hasn't been emailed yet.  If so, it sends an email which contains details of the record (one email for each record found).   Everything works, but ONLY if I have Server Admin running.  If not, the script fails for some reason?   Here is the current script:

 

Set Error Capture [On]

Go to Layout ["Incidents" (Incidents)]

Show All Records

Perform Find [Restore]

If [Get (LastError) = 401 ]

   Show All Records

   Halt Script

End If

Go to Record/Request/Page [First]

Loop

   Send Mail [Send via SMTP Server; No dialog; To: "email@email.com"; Subject "Incident Reported" & " " & Incidents::type . . . 

   Set Variable [$Error; Value:Get (LastError)]

   Set Field [Incidents::error_code; $Error]

   If [$Error = 0]

      Set Field [Incidents::emailed; "Yes"]

   End If

   Go to Record/Request/Page [Next; Exit after last]

End Loop

Show All Records

Set Error Capture [Off]

 

 

As I said above, this works every time when I have FM Server Admin open (like when I am testing and prompt the script to run from the schedules area).  Otherwise, everything in the script works except for the "Send Mail" part.  I added the variable $Error to figure out what was happening and when it fails I get the Error Code 1506 which is "Email(s) could not be sent successfully". 

 

Anyone have a clue as to what could be going on here?  I am completely stumped.

 

Thanks much,

-shawn-

 

Outcomes