Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Help with send email loop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Re: Help with send email loop

    Tom

    I'm going to have to do a little research and see how and where the report.saveas() works.

    I must have a single button that will send the emails and the button needs to be somewhere on the main menu, because the people that will be using the finished app have zero experience with Alpha Five.

    Thanks
    Tony

    Comment


      #17
      Re: Help with send email loop

      Alpha saves it where you tell it to.

      In Tom's example

      pdf_filename = "C:\Forecast\reports"+chr(92)+trim(loc1)+"_Pavement_forecast.pdf"

      So you just modify

      pdf_filename = "YOUR SAVED PDF FILE" <<<<<=================

      to save it where you want and name it as you like. Once and done.
      There can be only one.

      Comment


        #18
        Re: Help with send email loop

        IF privacy is not an issue.. privacy in this context means the recipients know/do not know who else received the same email.. you could create one string for all recipients and send the email once without looping..
        If, however; it is an issue, some email clients supposedly could hide the actual recipients' emails. I can't vouch for that since I did limited testing on it but it seems to work. Thunderbird for instance does that.

        Comment


          #19
          Re: Help with send email loop

          Tony,

          Once you get the code together and working as you like, save it as a script and then on the menu of your application, create a button with the following as the code:

          Code:
          script_play("your saved script")
          All your staff needs to do is to click on the button, and things will progress just fine.

          To thwart them form clicking multiple times, I would display some sort of message stating that things are progressing.

          see this thread:
          http://msgboard.alphasoftware.com/al...ad.php?t=51015

          Good luck,

          Tom

          Comment


            #20
            Re: Help with send email loop

            Tom and Stan

            Thanks again for your time and help!

            I have saved my report as a pdf.
            I pasted the code you last posted and changed the pdf file location to "my" file location as a new script, using the Xbasic editor.

            tblC = table.open("tourney")

            N = 20 'N is the number of e-mails to do in a batch
            L = 5 'L is the number of seconds to wait after each e-mail
            M = 60 'M is the number of seconds to wait between batches
            Skip = 0 'SKIP is the number of e-mails that had been sent in a previous attempt.
            param_to = ""
            query.filter = "current = \"Y\""
            query.order = ""
            ix = tblc.query_create()
            I = 1
            tblC.fetch_first()
            while .not.tblC.fetch_eof()
            if I < N
            param_to = ""
            if G1notify = "Y"
            param_to = alltrim(g1email)
            end if
            if g2notify = "Y"
            if param_to <> ""
            param_to = param_to +","+alltrim(g2email)
            else
            param_to = alltrim(g2email)
            end if
            end if
            pdf_filename="C:\GolfDatabase\Golf\Results2-ColTwo.pdf"
            msg_text = "Open the attached PDF to view tournament results"
            param_subject = "Anson Golf Tournament Results"
            param_msg = msg_text
            param_attachments = pdf_filename
            email_Send(param_to,param_subject,param_msg,param_attachments)
            tblC.fetch_next()
            I = I+1
            sleep(L)
            else
            sleep(M)
            I=0
            'tbl1.fetch_next()
            end if
            end if 'This is Line 40' <<<<<<<<<==========='
            end while


            When I try to save the script, I get the following error message

            "Error at line:40, column:1
            Error:Missing END WHILE command"

            I noted above where line 40 is

            Any ideas what I done wrong?

            Tony

            Comment


              #21
              Re: Help with send email loop

              I obviously screwed up. Get back to you in a few...

              ...later

              This is why I LOVE indents for if/endif pairs. It was left over from other code.

              Here it is fixed.

              Code:
              tblC = table.open("tourney")
              
              N = 20 'N is the number of e-mails to do in a batch
              L = 5 'L is the number of seconds to wait after each e-mail
              M = 60 'M is the number of seconds to wait between batches
              Skip = 0 'SKIP is the number of e-mails that had been sent in a previous attempt.
              param_to = ""
              query.filter = "current = \"Y\""
              query.order = ""
              ix = tblc.query_create()
              I = 1
              tblC.fetch_first()
              while .not.tblC.fetch_eof()
              	if I < N
              		param_to = ""
              		if G1notify = "Y"
              			param_to = alltrim(g1email)
              		end if
              		if g2notify = "Y"
              			if param_to <> ""
              				param_to = param_to +","+alltrim(g2email)
              			  else
              				param_to = alltrim(g2email)
              			end if
              		end if
              		pdf_filename="C:\GolfDatabase\Golf\Results2-ColTwo.pdf"
              		msg_text = "Open the attached PDF to view tournament results"
              		param_subject = "Anson Golf Tournament Results"
              		param_msg = msg_text
              		param_attachments = pdf_filename
              		email_Send(param_to,param_subject,param_msg,param_attachments)
              		tblC.fetch_next()
              		I = I+1
              		sleep(L)
              	  else
              		sleep(M)
              		I=0
              		'tbl1.fetch_next()
              	end if
              end while
              Last edited by Tom Henkel; 03-30-2011, 03:22 PM.

              Comment


                #22
                Re: Help with send email loop

                Tom

                Saved and ran, 3 errors returned.

                Variable "G1notify" not found

                Variable "G2notify" not found

                Could not connect to SMTP Server

                G1notify and G2notify are fields in my table, in case that matters.

                Thanks

                Tony

                Comment


                  #23
                  Re: Help with send email loop

                  That's me again...:o

                  g1notify and g2notify should be prefixed with "tblC."

                  Same for g1email and g2email.

                  Did you set up the Alpha e-mail client?

                  You need to specify whether you're using the built-in Alpha e-mail client or an external e-mail client such as outlook or eudora. If you're using the Alpha e-mail client, you need to set up the profile, SMTP server, POP server, etc.

                  Click on View->Settings->Email.

                  Once that is done, you should be OK.

                  Tom

                  Comment


                    #24
                    Re: Help with send email loop

                    Tom

                    Sorry, I should have included that info in my first post.
                    I am using Outlook Express

                    Do I need to change anything since I'm using Outlook Express?

                    Tony

                    Comment


                      #25
                      Re: Help with send email loop

                      see attached. If yours looks like this, you should be OK. If the system seems to be sending e-mails, then abruptly stops, its your ISP shutting you down for spamming. Change your timing numbers (up) until they don't close you down.

                      Tom

                      Comment


                        #26
                        Re: Help with send email loop

                        Tom
                        I have not set anything up within Alpha Five concerning email. Just to use my default Outlook acct. My email settings in Alpha Five looks like the screen shot you posted last night. However, the other tabs are blank. Is that the way it should be?

                        Using the first script I posted at the top of this thread, everything works fine with my Outlook Express email account. (Just the problem that only one record gets looked at, thus only the possibility of one email, containing two email addresses, being sent)

                        Any other ideas or different approaches?

                        Thanks
                        Tony

                        Comment


                          #27
                          Re: Help with send email loop

                          If you're using Outlook, then nothing else needs to be done with the settings. My guess is a timing issue. change the delay setting variables up by a few seconds
                          Code:
                          N = 20 'N is the number of e-mails to do in a batch
                          L = 5 'L is the number of seconds to wait after each e-mail
                          M = 60 'M is the number of seconds to wait between batches
                          Code:
                          [COLOR="Red"]N = 10[/COLOR] 'N is the number of e-mails to do in a batch
                          [COLOR="Red"]L = 8[/COLOR] 'L is the number of seconds to wait after each e-mail
                          [COLOR="Red"]M = 90[/COLOR] 'M is the number of seconds to wait between batches
                          I had a lot of trouble with my ISP thinking I was sending SPAM. This is something you will need to play with until it flows. It may be slow, but it will go.

                          Tom

                          Comment


                            #28
                            Re: Help with send email loop

                            Tom
                            The following code is working for me, but I think I may need to put the timer code in, because some of the people on the email list are not getting the pdf attachment.
                            I am only assuming that the problem may trying to send 50 or 60 emails, all at once, with attachments.
                            Can you help me with the code to include the timers?
                            Thanks
                            Tony

                            dim t as p

                            t = table.open("email")

                            t.fetch_first()
                            while .not. t.fetch_eof()

                            dim pm as P
                            pm.attachments = "C:\Flights.pdf"
                            pm.lrelated = .T.
                            pm.from = "[email protected]"
                            pm.from_alias = "my_company"
                            pm.to = t.email
                            pm.subject = "flight results"
                            pm.message = ""
                            email_send2(pm)
                            t.fetch_next()
                            end while

                            Comment


                              #29
                              Re: Help with send email loop

                              Tony,

                              I don't have my code here at the office, but I will get it at home this weekend, and show you the full looping script.

                              Tom

                              Comment

                              Working...
                              X