I did some more testing with this issue today and now I am even more confused!
I used a totally different database and set up a less complex script. Here is the script:
Set Error Capture [On]
Send Mail [Send via SMTP Server, No dialog; To: "email@example.com"; Subject: "Test"; Message: "Testing"]
Set Variable [$Error; Value:Get (LastError)]
Set Field [Global::test; Global::test & ¶ & $Error & " " & Get (CurrentTime)
I then set up a server side script schedule that runs the above script every 1 minute. Here are the results from the test field that captures the Error Code and Time:
1506 11:07:05 AM
1506 11:09:05 AM
1506 11:11:06 AM
1506 11:13:05 AM
0 11:13:27 AM
0 11:13:40 AM
1506 11:15:05 AM
1506 11:17:05 AM
1506 11:18:05 AM
0 11:19:02 AM
1506 11:20:05 AM
1506 11:21:05 AM
1506 11:22:05 AM
1506 11:23:05 AM
The script was successful three times (and I did receive the test email from those three successful attempts). The first two were a result of me running the script manually from within the Database using my copy of FMPA. The third success was from the scheduled script running on the server. The weird part is that I didn't do ANYTHING between the times of 11:17 - 11:21.
I tried a couple more tests with no success:
After doing some research online I noticed some slightly similar issues reported with FMS 10 where calculated Name and Subject fields were causing issues. I tried changing my Send Mail step to have no Name or Subject. The issue continued.
Next I tried changing my STMP setup. I was using "None" for authentication (which works fine in my mail client and also works for the SMTP setup on FM Server for sending out notifications of server errors, etc). I changed it to use "Plain Password" for authentication. The issue persists (and I was still able to run the script successfully from FMPA which indicates the SMTP settings were correct).
At this point I am not sure what else to try. I am looking forward to your suggestions! Perhaps this is a bug with FMS 11?
BTW: We are running the most up to date version of FMS 11 (v184.108.40.206)
Thanks for posting.
A few quick questions: Are emails being sent with attachments? Also, are you using SSL with your solution? If so, is it possible to disable SSL in conjunction with your 1 minute testing?
1> There are no attachments.
2> I am not using SSL.
Here are the exact settings used. Note that these settings are identical to the configuration in the "Email Notifications" section of FM Server Admin (which seems to be working fine). Also note that I am substituting "myserver.com" for our actual server name.
Send Mail Options:
Send via SMTP Server
Create: One email using data from the current record
Email address: "firstname.lastname@example.org"
Reply-To Address: "email@example.com"
Outgoing SMTP Server: "mail.myserver.com"
Connection Encryption: None
As I mentioned in my above post, I already tried using Authentication set to "Plain Password" and the same behavior persisted. It must be something happening on the server side because the email script works flawlessly every time that I run it manually while logged into the database using Filemaker Pro Advanced.
Hi Again (to anybody who is listening),
I spoke with our IT Manager who suggested that I try using the physical IP address for our SMTP server to see if that changes anything. I did this and it did change the script behavior somewhat. It seemed to result in less errors being thrown and more emails successfully going out. However, the issue is still present, just with errors happening less than before. I reported this to our IT Manager and he suggested that perhaps this is related to a timeout issue.
So here is my question at this point: How could I check / change the SMTP timeout setting that is used by a server side script that runs "Send Mail"??
I tweaked the script a fair amount so that the email now gets sent almost every time. What I did is to do the following:
1> Used the physical IP address for the SMTP server.
2> Put a loop around the "Send Mail" script step which keeps running until the returned error code is zero OR the loop has repeated 3 times.
Those changes seem to result in emails being sent every time. The issue now is that sometimes the 1506 error code is returned, but the email still somehow gets sent. This results in the loop sending out up to 3 duplicate emails (which could be confusing for the end recipients).
So the issue is still present, but I have created a workaround that mostly works. I am still interested in solving the root issue and would appreciate and feedback or ideas! :)
I am still looking for a solution to this issue. Anyone? Perhaps I should report this to Filemaker as a bug?
Sorry for the late reply.
A 1506 error just says the email could not be sent successfully, and I know that isn't helpful. I did notice some of the emails were sent successfully. Is there anything specific about those emails that you can discern? That is, are they being sent to the same host email (gmail, AOL, etc.)? Do you have names attached to the email addresses? Any other information about your mail server? Try specifying the IP Address of the mail server rather than by name.
In your script, just before "End Loop", try inserting a delay. That is:
Pause/Resume Script [ Duration (seconds): 5 ]
Does this make any difference?
Any other information you can provide may be helpful.
Thanks for the response. To answer your questions:
1> There is nothing different about the emails that go through (in my tests). When doing my tests I am sending the exact same email to the exact same email address (my email address). If you look at the script above you should see what I mean.
2> I don't have names attached to the email address (there is just one email address in my test).
3> I am using a standard SMTP server that is provided by inmotionhosting.com
4> I did try using the IP address instead of the name (as I mentioned in a post above).
I am curious why you suggest adding a delay before the end of the loop. In my understanding this won't solve the root issue of the first email not being sent properly. It may help to assure that the second attempt goes out properly, but in most cases the second attempt does work (except for once in awhile).
It seems you may of not read all of the above posts thoroughly. Did you see my note about setting the SMTP timeout settings? I am wondering if that could be a possible cause? Or perhaps this is a glitch with FMS?
Thanks again for helping on this. I have two other posts that are also unsolved and I would be thankful if you could check them out as well (since you have been a great help in the past):
Hi Again TSGal,
Also please note that this script is server side and according to FMP the "Pause / Resume Script" step is not compatible with FM Server so I wouldn't be able to use it anyways. :)
Might I suggest a possible hardware malfunction? Many of the issues we have had here, not the same but having a similar "quirky" feel to them, had to do with malfunctioning network routers.
It doesn't seem to be a hardware malfunction issue. The reason being that the FMS notification emails work every time (the emails that can be sent to notify the admin if there are various issues such as login errors, etc). I actually created a whole bunch of errors on purpose to verify this (I created the errors by loging into a hosted database with a wrong password over and over). The notification emails are setup using the exact same SMTP server/settings and are being sent to the same email that I have been using to test the server side email script.
My apologies for the incorrect reply about pause/resume script under Server. I was looking for a way to pause between sending of emails to see if that would help.
The timeout setting on the SMTP server should not be a factor, especially since this is occurring with the first email.
I set up something very similar to your settings.
No problems reported, and I have set this up with FileMaker Server 11v2 on Mac OS X 10.6.4, Mac OS X Server 10.5.8, Mac OS X 10.5.8.
Let me know what else to try.
Thanks for looking deeper into this. Just to be clear, when I said "timeout setting" I wasn't talking about on the SMTP server itself. I had imagined that when FMS attempts to connect to my SMTP server and send the email that it may fail if the process takes too long? Is this possible? If so, can that "timeout setting" be changed?
As I have said before, I am really confused by the fact that my server alert emails go through every time, but the server side script in question is having this issue. Since they are both using the same SMTP server, the same email, and the same basic settings, what could possibly be happening with the server side script that is creating this issue?
I am not sure how to proceed at this point. Any suggestions?