35 Replies Latest reply: Nov 28, 2012 8:00 AM by Amit Kakkad RSS

Dynamically send email

Sumit Thakur

How to write a macro to send an email to all email ids in a email ids field in the table object when it satisfies a particular condition???

  • Dynamically send email
    Fernando Suzuki

    Have you considered using Alerts? It is possible to use an expression to get the recipients from a field, and you can configure the condition to trigger the alert.

     

     

    Regards,

    Fernando

    • Dynamically send email
      Sumit Thakur

      Can you provide me an example???

      • Dynamically send email
        Jason Michaelides

        I think alerts are only available if you have Publisher.  If not you have to use a macro.

        • Dynamically send email
          Sumit Thakur

          Can u please share code for macros

          • Re: Dynamically send email
            Ravi Kumar

            Hi Sumit,

             

            Please see the attached sample file and Image.

             

            This is how you want.

             

            Follow the settings like in the image.

             

            and go to the Alerts wizard in the application and do changes.

             

            Let me know whether it works for you or not.

             

            Regards

            ....

            • Dynamically send email
              Sumit Thakur

              now  my question is

               

              suppose I have table which has fields Daycompleted,Employeeid,EmailId,Whenever any employee complete a 30 days in an office,an email should go to that particular email id..

               

               

              i have any answer please help me out..

              • Re: Dynamically send email
                Ravi Kumar

                Hi Sumitth,

                 

                Please check the latest attachment

                 

                I think your needed like this.(Don't forget to give Mail settings.)

                 

                reply me if it is fine.

                 

                Regards

                .....................

                • Re: Dynamically send email
                  Sumit Thakur

                  I will let u knw ,if its works fine.

                • Re: Dynamically send email
                  Ravi Kumar

                  Hi Sumitth,

                   

                  Please see the latest attachment.(Provide Mail settings)

                   

                  In the previous one i provide 2 buttons to complete the action how you need(for clear understanding)

                   

                  In this straightaway i am providing all the actions in a single button.

                   

                  Hope it will help you..

                   

                  reply me if it really helps you.

                   

                  Regards

                  .............

                  • Re: Dynamically send email
                    Sumit Thakur

                    It really works fine...

                     

                    Thank u for ur support

                    • Re: Dynamically send email
                      Sumit Thakur

                      It is possible that without clicking on go button the mail is send to the require employee dynamically after every 30 days as per his joining date

                      • Re: Dynamically send email
                        Ravi Kumar

                        Sumitth,

                         

                        Yes you can schedule(through windows scheduling) that file if you put all the actions which are available in button in "OnOpen" sheet trigger.

                         

                        What the scheduler will do is it will open and reload and save your app.

                         

                        I need to work on as per joining date after every 30 days mail sending.

                         

                        Regards

                        ............

                  • Dynamically send email
                    Anne Duffy

                    Hi Rav

                     

                    I have totally saved down your file to have a look at , but when I trigger the macro to run , it does not send the mails

                     

                    ( in my user preferences I have it set correctly ( as the test mail sends) and I have changed the employee mail addresses to my own)

                     

                    Yet when I press Go>> nothing happens ( as in - it does deselect accordingly but not send mail !!)

                     

                    Can you please help as Id love to be able to use this


                    Thanks

                     

                    A

                    • Re: Dynamically send email
                      Ravi Kumar

                      Hello Bloss,

                       

                       

                      if you want to send the emails to personel mails like gmail,yahoo.............

                       

                      You need to provide the correct server address and portno.

                       

                      If suppose an employee who is working in a company and the company might tie up with yahoo for using thier server

                      Yahoo will provide a particular serveraddress(eg:smtp.bizmail.yahoo.com,etc) and respective portno(eg:20,etc)

                       

                      If you provide these details the mail will approach the server and authenticate there and finally it will sent.

                       

                      So, please check the details once again.

                       

                      Regards

                      ....................

                      • Re: Dynamically send email
                        Sumit Thakur

                        i gone to document setting->trigger->Onopen->edit action...

                        there i have put all action that was used inside button.

                        after opening the alertmail.qvw it select the person to whom he has to send mail but it does'nt send it.

                         

                         

                        I am attaching qvw also for u..

                      • Dynamically send email
                        Anne Duffy

                        Hi Rav

                         

                        Thanks for response

                         

                        I was testing using my own mail address in the employee info.


                        See screen shots I have my portal info in user preference and when I test from there I receive the mail, but when I press the button on the sheet I do not receive the mail

                         

                        Am I missing something ?

                         

                        Thanks

                         

                        email test.bmp

                        • Re: Dynamically send email
                          Ravi Kumar

                          Hi Bloss,

                           

                          See the attached image and follow the settings like that.

                           

                          As per your screen shots you miss your UserID and Password fields.

                           

                          Hope it helps you.

                           

                          Regards

                          ..............

                          • Dynamically send email
                            Anne Duffy

                            Hey Rav,

                             

                            See the test mail works from the user preferences ( I have XXX over the company name in the screen shots)

                             

                            All the mails which I want to send is to

                             

                            anne.e.duffy@123( which is the address as set in the script) .ie

                             

                            The server address is

                             

                            smtp.123.pri

                             

                             

                            Not sure if there was somewhere else that I also needed to change

                             

                            Apologies for not getting this

                             

                            Thanks


                            A

                            • Re: Dynamically send email
                              Ravi Kumar

                              Hey Bloss,

                               

                              As per my understanding the testmail works for you.(Here you are not facing any problem)

                              But if you want to send the mail to your personel EmailID,It's not working.

                               

                              Is it right?

                               

                              If you want to send the mail to your personel ID, you need to give that particular server address and portno(ex:gmail) in the userpreferances.

                               

                              Regards

                              ...............

                              • Dynamically send email
                                Anne Duffy

                                Hey Rav,

                                 

                                The mail Does Not Send At All when using the alerts or the Macro. I wish to send it to anne.e.duffy@123.ie

                                 

                                The reason why I was showng you the user preferences was that the Test button on the mail works, so presumably I have the correct information set up.

                                 

                                The EMail address that I loaded into the script was copy and pasted excatly from the user preference set up so I do not understand why it will not send the mail when I press the button , unless there is somewhere else I need to update.

                                 

                                Thanks

                                 

                                A

                                • Re: Dynamically send email
                                  Ravi Kumar

                                  Hey Bloss,

                                   

                                  Do one thing send the screenshot of your "Alerts" window.

                                   

                                  If possible send one sample application.

                                   

                                  If you want to send the mail you need to follow these thinngs

                                   

                                  1->Mail settings.

                                  2->Alerts window conditions.

                                  3->Macro code.

                                   

                                  Regards

                                  ...........

                                  • Dynamically send email
                                    Anne Duffy

                                    Hi Rav

                                     

                                    See below ( Thanks a mill for taking the time to help me !!)

                                     

                                    I believe that my mail settings are ok ( as the test works)

                                    I believe that the alert is triggering ( as if I tick pop-up the popup fires onrelaod !!)

                                    When I test the macro it states executing yet does not fire the mail !!! ( the pop up shows though)

                                     

                                    Please also see script amendments

                                     

                                    Thanks again


                                    Anne

                                     

                                    if(ScriptErrorCount>=0) then
                                    set vAlert=1;
                                    ENDIF


                                    Test:
                                    Load * Inline
                                    [
                                    Emp_ID, DayCompleted, Emp_EMailID     
                                    00008 , 30   ,anne.e.duffy@123.ie
                                    00002 , 20   ,anne.e.duffy@123.ie
                                    00004 , 30   ,anne.e.duffy@123.ie
                                    00014 , 29   ,anne.e.duffy@123.ie
                                    ];

                                    if(ScriptErrorCount>=0) then
                                    set vAlert=1;
                                    ENDIF

                                     

                                     

                                     

                                    Alerts screen.bmp

                                    • Re: Dynamically send email
                                      Ravi Kumar

                                      Hi Anne,

                                       

                                      The script is correct.

                                       

                                      Even if you are not providing any recipent list also,it will show the alert message as a pop-up.

                                       

                                      I have a doubt

                                       

                                      I don't know what you are providing in the Alert window.

                                       

                                      Please see the attached image and check in your application like this you are following or not.

                                       

                                      Regards

                                      ...............

                                      • Re: Dynamically send email
                                        Anne Duffy

                                        Hi Rav

                                         

                                        Thanks so much for your time,

                                         

                                        The mails still wont fire when pressing the Button,

                                         

                                        I officially give up !!

                                         

                                        Thanks


                                        A

                                        • Re: Dynamically send email
                                          Ravi Kumar

                                          Anne,

                                           

                                          If possible attach your sample file.

                                           

                                          Regards

                                          ...........

                                          • Re: Dynamically send email
                                            Anne Duffy

                                            Hi Rav

                                             

                                            See attached ( this is my first time putting up a doc so I hope it posts ok!!)

                                             

                                            Thanks


                                            A

                                            • Re: Dynamically send email
                                              Ravi Kumar

                                              Anna,

                                               

                                              you are getting any error message when you clcik on Button after popmessage display.

                                               

                                              Regards

                                              ..........

                                              • Dynamically send email
                                                Anne Duffy

                                                No , No error , just the yellow pop up I pres the x to close and that is is !!

                                                 

                                                Its very strange !!!

                                                • Re: Dynamically send email
                                                  Ravi Kumar

                                                  Anne,

                                                   

                                                  Here everything is working fine.

                                                   

                                                  I am not getting why it won't work from your side.

                                                   

                                                  So do this,

                                                   

                                                  Go to Mail settings and select Authentication Method as "AUTH LOGIN" and provide your mailid and password.

                                                   

                                                  Let me know what you are getting this time.

                                                   

                                                   

                                                  Regards

                                                  ..................

                                                  • Dynamically send email
                                                    Anne Duffy

                                                    Hey Rav

                                                     

                                                    Still not working , is theone I sent you sending emails and if so to whom and where did you amend the address on the dashboard.

                                                     

                                                    Its cool honest if you want to leave this , this sort od stuff is enough to drive anyone barney !!!

                                                     

                                                    Thanks


                                                    A

                                                    • Re: Dynamically send email
                                                      Ravi Kumar

                                                      Anne,

                                                       

                                                      I worked on your file only by changing with my emailID in the script for corresponding 30 days and reload the file.

                                                      Now i got my email in the listbox.

                                                       

                                                      I gave my credentials in the Mail settings window.

                                                       

                                                      I provided the button actions in OnOpen trigger also.

                                                       

                                                      Now if i click on button or close and open the file also the trigger fires and i am getting a new mail alert to my inbox.

                                                       

                                                      This is what happening from my side.

                                                       

                                                      Regards

                                                      .............

                                                      • Dynamically send email
                                                        Anne Duffy

                                                        Rav

                                                         

                                                        Last response I promise!!

                                                         

                                                        I have gone into the Alert and removed the formula for the mail receipients and put my address in there and it still did not work !!!

                                                         

                                                        I really think my issue is with the alert function - But I simply dont understand

                                                         

                                                        Thanks a mill for all yuour help I will post again if I get it going

                                                         

                                                        Thanks


                                                        A

                                                        • Re: Dynamically send email
                                                          Ravi Kumar

                                                          Anne,

                                                           

                                                          No problem

                                                           

                                                          Just do a test like this.

                                                           

                                                           

                                                          1.Go to Alert window,In the recipents list give your emailID and check AlertID(AL01).

                                                          2.In the mail settings provide settings like how i specified in the previous posts.(Auth Method:AUTH LOGIN)

                                                          3.Take another button and provide macro action only.

                                                           

                                                          Now click on the new button and check your inbox after that.

                                                           

                                                          Reply me with your result.

                                                           

                                                          Regards

                                                          ..................

                                            • Re: Dynamically send email
                                              Amit Kakkad

                                              Thank you for your great work. These works for me. Cheers.