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

Sending Personalized Reports in Batch Email

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

    #31
    Have you given thought to send your emails as Viewbox generated rather than pdf?

    Pete
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein, (attributed)
    US (German-born) physicist (1879 - 1955)

    Comment


      #32
      Originally posted by aprescott View Post
      Can you elaborate? I'm open to other options if I can get it working. My current solution was working perfectly until I moved it over to the server.
      It's a Permissions Issue if it works locally and not on the server.
      Contact your host. As them where the blockage is. They should be able to see the exception being thrown.
      Look for folders/files being created on the server to support the mailout.
      See our Hybrid Option here;
      https://hybridapps.example-software.com/


      Apologies to anyone I haven't managed to upset yet.
      You are held in a queue and I will get to you soon.

      Comment


        #33
        peteconway This intrigues me. I'm looking at a lot of Alpha docmentation/videos on emails and reports with viewboxes, but being completely new to viewboxes its a little beyond me. Also can't find anything leading to a bulk email. Can you point me in the right direction?

        Comment


          #34
          I use SQL Agent & Database mail for batch or single email functions.  I use email templates so content can be updated easily. This includes Text and HTML formats.  
          To make it easier, I have an email_box table that uses a trigger to fire the SQL Database mail procedure (EXEC msdb.dbo.sp_send_dbmail).  I use this as an email history table
          In my production systems, the SQL database server is separate from the web server so these emails do not have any impact on my Alpha applications.  
          If this is of interest, I can post some scripts with examples to show how easy this is to set up and implement.  SQL Database mail does not allow PDF attachments since there are security issues regarding the file system. I prefer to dynamically create nice HTML emails.
           

          Comment


            #35
            frankiez I would be very interested in seeing an example of how you set this up.

            Comment


              #36
              gianfior85  ---Give me a day or two and I will put a simple example together using the SQL Northwind database. 

              Comment


                #37
                OK sports fans, It's been a long journey but I believe I almost have it sorted!

                I present the following code:
                Code:
                function sendmail as c (e as p)
                debug(1)
                dim donCN as sql::Connection
                dim donARGS as sql::Arguments
                dim sqlCode as p
                dim itsOpen as l
                dim itWorked as l
                dim donorArray[0] as p
                dim js as c
                
                sqlCode.getData = <<%txt%
                SELECT * from monthgift
                where mailpreference='EM' AND mailtrigger = 'Y'
                group by id_number
                
                %txt%
                itsOpen=donCN.open("::name::donor sql") 'Use this to check that the database connection works
                itWorked = donCN.ToPropertyArray(sqlCode.getData,donorArray) 'Use this to verify that the data is added to the array (donorArray)
                
                for each donor in donorArray
                [COLOR=#c0392b][B]donargs.set("ARGID",donor.id_number) 'The viewbox is filtered to generate the report by argument ARGID.[/B][/COLOR]
                'read the css from the control definition
                dim ix as n
                dim tmpl as p
                tmpl = e.tmpl
                ix = tmpl.page_fields.findi("vb","v.variablename")
                if ix > 0 then
                dim json as c
                json = tmpl.page_fields[ix].v.viewbox.definitionJSON
                dim p as p
                p = json_parse(json)
                dim css as c
                css = p.formview.css
                end if
                
                dim html as c = "<html><head><style>" + css + "</style></head><body>" + crlf() + e._html + "</body></html>"
                
                dim MyOrganizationEmailAddress as c = DummyEmail@Address
                dim Email as c
                Email = ""
                Email = donor.email
                dim SparkpostKey as c = SPARK POST KEY GOES HERE
                dim pm as p
                pm.send_to = Email
                pm.from_name = "Patrick Eades - Skylark Clinic, Inc."
                pm.from_email = MyOrganizationEmailAddress
                pm.subject = "Skylark Monthly Giving Record"
                pm.message_html = html
                pm.options.inline_css = .t.
                pm.attachments = "c:\A5Webroot\PC\December2021.pdf"
                pm.message_text = ""
                
                'this property is very important. if you don't set this property the email message will not use the stylesheet
                pm.options.inline_css = .t.
                dim pResult as p
                pResult = email_send_sparkpost(SparkpostKey,pm)
                dim count as n
                if pResult = .t. then
                count = count+1
                end if
                next
                if count >= 1 then
                
                js= "alert('Successfully sent " + AllTrim(count) + " Emails');"
                end if
                sendmail = js
                end function
                Screenshot 2021-11-24 084536.jpg


                I have success when I hard code in the SQL query to send to only one email (viewbox is correctly generated and email successfully sends) but now I need it to loop through the donor array and generate the viewbox/send email for each one. I'm not certain the best way to go about that. I tried setting an argument but I don't know I'm on the right path. Further, I don't think I'm actually calling that argument in the xbasic.

                Any thoughts? I am so close!!

                Comment


                  #38
                  I’m away from the desk this week, but the actions in the view box definition do what you want to do, they fire for each new record put your code say in the post or pre-render or on complete. Sorry can’t be more specific I don’t have a pc with me.
                  Insanity: doing the same thing over and over again and expecting different results.
                  Albert Einstein, (attributed)
                  US (German-born) physicist (1879 - 1955)

                  Comment


                    #39
                    So call the sendmail(); function in the on.populate Event
                    Insanity: doing the same thing over and over again and expecting different results.
                    Albert Einstein, (attributed)
                    US (German-born) physicist (1879 - 1955)

                    Comment


                      #40
                      Looking at the debugger, it looks like e._html is not getting a value, so my final HTML for the email has nothing in the <body> tags. Is there somewhere with documentation on e._html? the only other reference to _html I can find is from the Video tutorial I am copying is in the Javascript when I call the sendmail function:

                      Code:
                      var html = $('viewboxcontent').innerHTML;
                      var data = A5.ajax.buildURLParam('_html',html);
                      
                      
                      
                      {dialog.object}.ajaxCallback("","","sendmail","",data);
                      I have tried this code in both the onpopulate event as well as on a button on the page. I'm not even sure if this is the same thing as e._html is referring to.

                      Comment


                        #41
                        I'll take a look today for you i'm back in the chair is the code shown your latest? send your vb.
                        Insanity: doing the same thing over and over again and expecting different results.
                        Albert Einstein, (attributed)
                        US (German-born) physicist (1879 - 1955)

                        Comment

                        Working...
                        X