12 Replies Latest reply on Jun 16, 2009 12:49 PM by mrvodka

    SMTP Mail Script.



      SMTP Mail Script.

      Your post

      Hi.  I have a question regarding the setup of an SMTP email from the server...


      I'm using FM Server 10.  The database is hosted on that server and I created a mail script to loop through all records and when the days remaining = 15, it should send an email via SMTP. 


      I created the script and tested it on the database using the client side email, and it worked fine.  Made the changes to the SMTP settings and tried running it from the server and no email was sent.  the SMTP settings are the same as setup in the server for notification emails.


      To clarify, I created a scheduled task on the server to run the script once a day at a certain time.  The status says OK from the admin console.


      Am I doing this correctly?  Does this require a system level script?  If so, can anyone give me an example of a system level script that will send SMTP email.






        • 1. Re: SMTP Mail Script.
             are there any script steps in there that are not server compatible?
          • 2. Re: SMTP Mail Script.

            No.  All are server compatible.


            Loop, Send Mail, Goto next record, etc.

            • 3. Re: SMTP Mail Script.

              You should be able to run the script from the server as you are doing. I would make sure that no firewalls are blocking port 25 or whatever else may be designated as your smtp port.


              A quick way to test if emails are being sent sucessfully is to create a quick backup script and in the server admin console, set up it to send you an email. Once you have it setup, run the backup script. If you get the email then most likelyyour port is fine, if not I would definitely start looking to do a port check. 


              You can try using telnet to that server on the port.



              • 4. Re: SMTP Mail Script.

                Actuall, I've done that.  I have the script send me email when it runs.  That's the only email I recieve.  Could it be the email address?  I entered it manually instead of using the arrow (-->) to pick the address from the contacts.  Do you know of any bugs with this script? 


                The email entered was in the standard format, firstname.lastname@company.com


                Thanks for your help,


                • 5. Re: SMTP Mail Script.

                  So after some more testing, I was able to send email by running the script on my PC through the server (it did not use the email client to send email), but when I try and run it as a scheduled task from the server, no luck.


                  Any additional help would be appreciated.



                  • 6. Re: SMTP Mail Script.


                    1. I am able to run the send mail script from FMP 10 successfully
                    2. Running the script from the server (scheduled task) fails.  I only recieve the system email telling me the script ran.
                    3. Testing the SMTP setting on the server are successful, through the Admin Console.

                    So, my only conclusion is that there is a problem with the server installation, settings or maybe even a firewall rule that's preventing the script from actulaly sending the email.


                    Any other suggestions?


                    Thanks in advance,


                    • 7. Re: SMTP Mail Script.
                         Do you see any error messages in the server's log after the script is run? That might also give you a clue.
                      • 8. Re: SMTP Mail Script.
                           Nope.  The task run is listed in the log, but no error messages are present.
                        • 9. Re: SMTP Mail Script.

                          Try creating a brand new script with only the Send Mail script with SMTP. Also leave out the Name field under User Info.

                          Try also using an account with [Full Access] to run the script.



                          • 10. Re: SMTP Mail Script.

                            I'll give that a try and report back.  Appreciate your help!

                            • 11. Re: SMTP Mail Script.

                              Mr Vodka, that worked!  I'm not sure why, but I added a new script with only the send mail function, left the user information (name) blank and tried running from the server, and it worked!!  I recieved both emails.  The one generated by the send mail script and the system email telling me the scheduled task was run.


                              I appreciate all your help.



                              • 12. Re: SMTP Mail Script.

                                Glad that you got it working. You may have had a server incompatible script step in there. Also there have been issues with having a value in the name field for the user settings.


                                It was a firewall issue because you were getting the other emails from server. That is why I had you test it earlier.