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



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

Send a Report Via E-Mail

  • Filter
  • Time
  • Show
Clear All
new posts

    Send a Report Via E-Mail

    Hi Everyone-

    I know I'm missing something obvious, but I can't find an Action Script to do what I want.

    I've created a report that users can preview, on their screen, for the record they're viewing. I've added a Button onto the report that will "attach that 1-page report to an Outlook e-mail message."

    I have one problem: The only Action Script option that does what I want is called "Send a Layout via E-mail". That option is almost PERFECT. It attaches a report file, linked to the "Invoice #" (InvNum) field on the displayed report, to a new e-mail message in Outlook. The user can add his "To" address and send it (I've even pre-filled the subject).

    Here's the problem: When I try to add the report that I want to the Button's Action Scripting, it finds only the reports listed on the standard "Control Panel," NOT the Reports listed in Reports section the "Web Projects Control Panel". I've looked all over for a way to point to the reports I've created in the Web Projects Panel... OR to find a similar Action Script that called "Send a Report Via E-mail", which would use the Web Projects Panel, but that option isn't on the list (see image below). I've even tried to duplicate/copy my report to the Standard Control Panel, so that I could use it, but I couldn't figure out an easy way to do that, either.

    Alpha email.jpg

    Perhaps, there's a better way to accomplish this, than to place a Button right on the report, but I couldn't think of a good way to do it. I can easily send an e-mail with XBasic, but I couldn't find a way to simply attach the report to an e-mail message that the user can add address, subject, etc.

    I'm looking for any help/suggestions that you can offer.


    Re: Send a Report Via E-Mail

    I thought this was something simple, but, so far, I haven't had any replies. Is there anyone who can help me with a simple process of attaching a report to an e-mail. I want to be able to click a button to e-mail an attached receipt for an order. The button to display/print the receipt works perfectly. I'd like to be able to have that document attach to an Outlook Message where the user can type the address, subject and/or "body" text... OR I can have a UX Popup with the fields for Address, Subject and Body text and have it send.

    Whichever is easier. I just don't know how to make that report (linked to the current row) attach to an e-mail.

    I sure would appreciate any help or suggestions.


      Re: Send a Report Via E-Mail

      Phil (depending on which version of AS your using) you should find a checkbox option to email your report in the ActionScript action "Open a Report, Label, or Letter Layout" complete with the fields you need.
      NWCOPRO: Nuisance Wildlife Control Software My Application: "Without forgetting, we would have no memory at what was I saying?"


        Re: Send a Report Via E-Mail

        Hi Charles-

        THANK YOU for taking the time to write! I did check that box, but the message did NOT send. ALSO, even if it did work, that option doesn't give the user any control over who it's address to (e.g. I can "hard code" the address, OR I could use a field in the current record, but it's out of the control of the user). And, there's certainly no option for the user to add information in the body of the e-mail text.

        FYI, I'm using version Build 5271.

        Check out "send a layout via e-mail". That simply attaches a file to an Outlook message that the user can address, etc. That would be great. BUT, I can't figure out how to make that work with a report tied to the current record.

        I guess, if you can help me make the e-mail checkbox you referred to work, I can get by with that. When I tried it with Live Preview/Working Preview and click the button, nothing happens.

        Thanks for your help. If you have any additional thoughts, I'd appreciate them.


          Re: Send a Report Via E-Mail

          This is what I get, when I try to send an e-mail in "Live Preview". Maybe this will help.

          e-mail error.jpg


            Re: Send a Report Via E-Mail

            Well I am certainly no expert but I can share what I have.
            To set the send to fields and such using a UX btw, I run 2 xbasic functions because this is a multi-tenant app but the idea would be similar regardless. The target should be set to an xbasic function.
            here are the two I use but you can set your values how you like.

            function setmailto as c (e as p)
            	session.mailedto = e._currentRowDataNew.EMAIL
            	session.sentto = session.mailedto + " " + Date()
            	'session.mailfrom = e._currentRowDataNew.REPLYEMAIL
            	session.mymsg = e._currentRowDataNew.CUSTOM_MESSAGE
            	session.sentto = session.mailedto + " " + Now()	
            end function
            function ReportForEmail as c (e as p)    debug(1)
            dim key as c 
            key = e.fileSessionKey
            dim b as b 
            'get the binary day for the report
            dim size as n 
            size = b.size()
            if size = 0 then 
                ReportForEmail = "alert('Report was not sent.');"
                exit function
            end if 
            'dim mysecretkey as c = ""   'if you leave this blank the key value is read from a setting in Project Properties
            dim ms as p
            dim date as d
            ms.send_to = session.mailedto
                if session.mailedto = "" then
                    ReportForEmail = "alert('Email Address is missing or invalid!');"
                    exit function
                end if
            ms.from_email = "[email protected]"
            ms.subject = "Wildlife Control Invoice/Estimate"
            ms.message_html = "Please find the attached invoice and or estimate." + "<br>" + session.mymsg + crlf()+\ 
            "<br>""<br>""<br>""<center><b>Confidentiality Notice:</b> This e-mail message, including any attachments,is for the sole use of the intended recipients." + crlf()+\
            "It may contain confidential and privileged information or may be otherwise protected by law." + crlf()+\
            "Any unauthorized review, use, disclosure or distribution is prohibited." + crlf()+\
            "If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message." + crlf()+\
            "If you received this email by mistake, send complaints/concerns to [email protected]</a>This email is generated using NWCOPRO software.</center>" 
            dim ms.attachmentsArray[1] as p
            ms.attachmentsArray[1].name = "Wildlife Control.pdf"   'if the report was an html report, use the .html extension
            ms.attachmentsArray[1].type = resolve_mime_type("pdf") 'if the report was an html report, use the 'html'
            ms.attachmentsArray[1].content = base64encode(b)
            dim pResult as p
            pResult = wt_email_send_sparkpost("",ms)
            ?"RETURNED: " + pResult.body + "<hr>"
            ?"POSTED  : " + pResult.json + "<hr>"
            ?"HASERROR: " + convert_type(pResult.error,"C")
            ?"APIERROR: " + convert_type(pResult.error,"C") + "<hr>" '==True IF SPARKPOST RETURNED AN ERROR OF ANY KIND
            if pResult.error = .f. then
            	ReportForEmail = "alert('Your Invoice/Estimate was sent.');"
            	save_to_file(pResult.body + crlf(2) + pResult.json,"H:\a5\bodysent.txt") 
            	ReportForEmail = "alert('Your Invoice/Estimate was not sent.');"
            	save_to_file(pResult.body + crlf(2) + pResult.json,"H:\a5\bodynotsent.txt")
            end if
            end function
            I test live in my app and really only using working or live preview to check visuals because I filter the records by session vars based on groups and users company_ids - if do test such stuff locally I have to hard code those values so it's just easier to setup a test page for testing live on my server, but that's just me. Hope this helps!
            As I said, I am not an expert and probably over use session vars but this works for me in my situation.

            In the open a pdf action script I run "ReportForEmail" the other xbasic (sendmailto) I run prior. attached shows the order I run them. It could be laid out more efficiently to combine stuff but it was easier for me to debug as I built it and was learning.
            NWCOPRO: Nuisance Wildlife Control Software My Application: "Without forgetting, we would have no memory at what was I saying?"


              Re: Send a Report Via E-Mail

              Charles... Once again, thank you for your response. I will try two things:
              1. I love your XBasic Code for the UX... Looks perfect for what I'm trying to accomplish (you're too modest about "not being an expert"... it looks great!). I will give that a try to see if it works the way I want it to.
              2. I will try uploading the "Send e-mail" code (from the Action Script) to a "live" server to see if it works that way. It makes sense to me, rather than Live or Working Preview.

              I will work on this within the next day and I'll let you know how they work.

              It was very generous of you to give your time to answer my question. I can't tell you how much I appreciate it.