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

How did you integrate email send/receive into your web application?

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

    How did you integrate email send/receive into your web application?

    Can Alpha's email client be used in the web application? I am investigating integrating access to email directly into our web application and wanted to know what (if) people did to make this happen. Any pitfalls or gotchas I should know about?

    Thanks
    ---
    Sarah
    Alpha Anywhere latest pre-release

    #2
    Re: How did you integrate email send/receive into your web application?

    Hi,
    I use outgoing email and texting routinely with both desktop and web apps. As far as processing incoming email, I have never had much luck using the email client. The Alpha email doesn't seem to handle it well. I think the client was written years ago and hasn't been updated. Most of the trouble was handling attachments and some emails with the html text in the message body.

    I'd be glad to send some info if you want some ideas on outgoing.

    Mike
    Mike Reed
    Phoenix, AZ

    Comment


      #3
      Re: How did you integrate email send/receive into your web application?

      Yes I have a web app running under ver 9 that sends email but does not receive any. These emails are generated by the app in accordance with the users' activity but the user does not actually write the email. For example when a web user approves a certain transaction an email is sent to another user. These emails use some prepared text but some parts like user names are filled in on the fly. Sometimes reports are attached to the emails. It would not be hard to allow the user to type the email content. I use calls to email_smtp_open, email_smtp_send and email_smtp_close.
      The only caution I have is be sure to keep a log file. Only rarely does an email fail but when it does I log it and keep a copy of the failed email's contents so I can manually resend it later. I am attaching a copy of my routine "emailcore" and I apologize for a few references to other routines. demoval("Prefemail", loginid) returns the email address of the recipient and failed_emails writes the email detail to a data table for resending later. The log file is updated by the routines that call emailcore. Note the multiple sends and resends and timing delays in the routine. I found those by trial and error and maybe 1 percent of emails do require these extra delays. I would be happy to share the details of the calling routines but I hope this gives you an idea. As is the system works quite well.
      Good luck,
      Irwin

      Code:
      'Date Created: 25-Dec-2010 11:46:46 AM
      'Last Updated: 13-Oct-2013 11:04:55 AM
      'Created By  : Irwin
      'Updated By  : Irwin
      'Result is < 10 if the email was not sent
      'open1	send1a  send1b 	open2   send2a  send2b	     total
      ' 0			x      x		0       x       x		0     neither open
      ' 1			0      0		0       x       x		1     1st open, no send, 2nd no open
      ' 0			x      x		2       0       0		2     2nd open, no send
      ' 1			0      0		2       0       0		3     both open, neither send
      ' 1			10     x 		x       x      	x		11    1st open and send1a
      ' 1			0     100		x       x      	x		101   1st open and send1b
      ' 0			x      x		2      20      x		22    1st no open, 2nd open and send2a
      ' 0			x      x		2      0      	200		202   1st no open, 2nd open and send2b
      ' 1			0      0		2      20      x		23    1st open, no send, 2nd open and send2a
      ' 1			0      0		2      0      	200		203   1st open, no send, 2nd open and send2b
      'sent > 10, failed < 10
      
      function emailcore as n (loginid as c, thesubject as c, thetext as c, theattachments as c)
      emailcore = 0
      dim pm as P
      dim ps as P
      dim eflag as l
      eflag = .f.
      ps.timeout = 10000
      eflag = email_smtp_open(ps, "myserver", port, "my account", "my pw")
      if eflag
      	emailcore = emailcore + 1
      	pm.to = alltrim(demoval("Prefemail", loginid))
      	pm.from = "[email protected]"
      	pm.from_alias = "NPAP Database"
      	pm.subject = thesubject
      	pm.attachments = theattachments
      	pm.message = thetext
      '	pm.html_message = thetext	'this need <br> not cflf()
      	eflag = email_smtp_send(pm, ps)		'send 1a
      	if eflag	'.f.=not sent, .t.=sent
      		emailcore =  emailcore + 10
      	else
      		eflag = email_smtp_send(pm, ps)	'send 1b
      		if eflag
      			emailcore = emailcore + 100
      		end if
      	end if
      	if .not. email_smtp_close(ps)
      		emailcore = emailcore - 1000
      	end if
      end if
      if eflag = .f.	'.f.=not sent, .t.=sent
      	sleep(5)
      	ps.timeout = 10000
      	eflag = email_smtp_open(ps, "myserver", port, "my account", "my pw")
      	if eflag
      		emailcore = emailcore + 2
      		pm.to = alltrim(demoval("Prefemail", loginid))
      		pm.from = "[email protected]"
      		pm.from_alias = "NPAP Database"
      		pm.subject = thesubject
      		pm.attachments = theattachments
      		pm.message = thetext
      '		pm.html_message = thetext	'this need <br> not cflf()
      		eflag = email_smtp_send(pm, ps)		'send 2a
      		if eflag	'.f.=not sent, .t.=sent
      			emailcore = emailcore + 20
      		else
      			eflag = email_smtp_send(pm, ps)	'send 2b
      			if eflag
      				emailcore =  emailcore + 200
      			end if
      		end if
      		if .not. email_smtp_close(ps)
      			emailcore = emailcore - 2000
      		end if
      	end if
      end if
      if emailcore<10
      	failed_emails(Loginid, Thesubject, Thetext, Theattachments)
      end if
      end function

      Comment


        #4
        Re: How did you integrate email send/receive into your web application?

        Thanks Irwin for the ps.timeout....I am going to add that to mine.
        Also a very good reminder about the log file. I have discovered that is an essential item.

        Here is a function that I use that is MySQL based. It is similar to Irwin's except that I have MySQL table called email_Control. It contains the userid, port, mail server address and password for the outgoing mail server. It also has a priority field. The file was originally setup as place to keep the email server login info. So that if the user changes their email server, one entry in the table to change parameters and its done. That worked fine. But then the user started have trouble with limits and availability of the email server. They had at one time 3 different outgoing servers that could be used. So we added the priority column. So the routine loads the info for all the possible outgoing mail servers. If one failed, then it goes to the next. The initial response from the function is 0. If the mail is accepted by any of the servers, then the response is changed to the mail server address. So it makes it easy to let the user know if the outgoing mail failed.

        This one is also different in that it takes all the info for the email, so the command looks like this:

        sql_email_send("[email protected]","[email protected]","subject","message","HTML","[email protected]","[email protected]","c:\a5webroot\myfile.txt") If the is no CC, BCC, etc, then just enter the quotes. And of course, variables can be used instead the "typed info"

        So any place I need to send an email, I just call this function. As Irwin mentioned reports can be attached, just create and save the report first, then include the file(s) name(s) where indicated.

        I have been using this for a long time. I am however converting everything over to little different process. We have a set up an old computer whose job in life is to send out emails only. (it is like 5 years old, we just a new hard drive and power supply in it and it works fine to send email.) This new process frees up the web app and desktop from having to wait for the actual email process to respond, especially if a large report or file is included. We just offload all the email stuff and attachments to the old computer and it sends the emails. And a log file is integral to it. It runs under the Alpha 5 runtime. Since that is a little more complex I didn't include it here, but I'd be glad to send it if you want.

        Anyway here is the function:

        FUNCTION sql_email_send AS C (email_to AS C, email_from AS C, email_subject AS C, email_msg AS C ,email_type AS C, email_cc AS C, email_bcc AS C, email_attachment AS C )
        'email_type - leave blank if the message is not HTML formatted, else enter "HTML"
        dim ps as p
        dim pm as p
        dim email_result as l
        dim e_cnt as n
        dim smtp_cnt as n
        dim smtp_recs as n

        dim cn as SQL::Connection
        cn.open("your connection")
        dim qry as c
        qry = "SELECT * FROM email_control ORDER BY priority"
        cn_result = cn.Execute(qry)
        rs = cn.ResultSet
        cn.Close()
        txt = rs.ToJSONObjectSyntax(10)
        dim arr[0] as p
        A5_JSON_PopulateArray(arr,txt)
        smtp_recs = arr.size()
        sql_email_send = "0"
        e_cnt = 1

        starthere:
        v_site = arr[e_cnt].smtp
        v_port = val(arr[e_cnt].port)
        v_user = arr[e_cnt].user
        v_pswd = arr[e_cnt].password

        IF (email_smtp_open(ps, v_site, v_port, v_user, v_pswd )) THEN
        pm.to = alltrim(email_to)
        pm.from = alltrim(email_from)
        pm.subject = alltrim(email_subject)
        IF email_type = "" THEN
        pm.message = alltrim(email_msg)
        ELSE IF email_type = "HTML"
        pm.html_message = alltrim(email_msg)
        END IF
        IF email_cc <> "" THEN
        pm.cc = alltrim(email_cc)
        else
        pm.cc = ""
        END IF
        IF email_bcc <> "" THEN
        pm.bcc = alltrim(email_bcc)
        else
        pm.bcc = ""
        END IF
        IF email_attachment <> "" THEN
        pm.attachments = alltrim(email_attachment)
        else
        pm.attachments = ""
        END IF

        email_result = email_smtp_send(pm, ps)
        IF email_result THEN
        sql_email_send = arr[e_cnt].smtp
        goto quit
        ELSE

        IF e_cnt < smtp_recs THEN
        e_cnt = e_cnt + 1
        goto starthere
        ELSE
        goto quit
        END IF
        END IF
        end
        ELSE
        IF e_cnt < smtp_recs THEN
        e_cnt = e_cnt + 1
        goto starthere
        END IF
        END IF
        quit:

        END FUNCTION
        Mike Reed
        Phoenix, AZ

        Comment


          #5
          Re: How did you integrate email send/receive into your web application?

          Sarah, these guys' suggestions are far more robust than mine for the outgoing, but I agree from experience that you cannot trust the A5 incoming email system. We found a program called Process Them that watches assigned POP or IMAP email inboxes and can write parameters (e.g. subject, attachments, etc) to a SQL database, download attachments into a directory on the server, or trigger a file to be run. It has almost no further features, but it does what it's supposed to consistently. Then you can write your own code to process these records and files further depending on your needs. There's a more feature-rich program called Email2DB that some Alpha folks are using as well.

          Comment


            #6
            Re: How did you integrate email send/receive into your web application?

            This information is great! Thank you so much for your feedback. Keep it coming!

            Receiving incoming email is a must. My goal is to provide the client a central location to access all communications they have with their customers - email, phone logs/records, and online form submissions/exchanges.
            Alpha Anywhere latest pre-release

            Comment


              #7
              Re: How did you integrate email send/receive into your web application?

              I should clarify that we are currently working out our system to handle all incoming and outgoing emails, but we've been using Process Them for years now to check some email accounts. Keep us posted on insights you might have.

              Comment


                #8
                Re: How did you integrate email send/receive into your web application?

                Originally posted by TheSmitchell View Post
                Can Alpha's email client be used in the web application? I am investigating integrating access to email directly into our web application and wanted to know what (if) people did to make this happen. Any pitfalls or gotchas I should know about?

                Thanks
                ---
                Sarah
                Receiving incoming email is a must
                I send emails alone or with reports from my intranet application. sending seems easy.

                the alpha email functions, I think, work with pop3 only not imap. I tried setting up with imap and did not succeed. with pop, synchronization may not be possible, and the message will get downloaded regardless of whether It was downloaded earlier.(unless you delete them from the server after downloading., then they are gone from accessing from elsewhere)
                there is a email_receive() function. you can check and see if there is a way to filter the ones downloaded and somehow synchronize with the server.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #9
                  Re: How did you integrate email send/receive into your web application?

                  Originally posted by GGandhi View Post
                  I send emails alone or with reports from my intranet application. sending seems easy.

                  the alpha email functions, I think, work with pop3 only not imap. I tried setting up with imap and did not succeed. with pop, synchronization may not be possible, and the message will get downloaded regardless of whether It was downloaded earlier.(unless you delete them from the server after downloading., then they are gone from accessing from elsewhere)
                  there is a email_receive() function. you can check and see if there is a way to filter the ones downloaded and somehow synchronize with the server.
                  Lack of imap support might be a problem. :/ I have a feeling I'll need to resort to some other language, such as php, to accomplish receive. Unless V12 has made some headway in this department?
                  Alpha Anywhere latest pre-release

                  Comment


                    #10
                    Re: How did you integrate email send/receive into your web application?

                    I use a program by parker software called email2db which works awesome you can even parse or extract data and directly insert or update data to most types of sql. I use it for an order entry system that pulls customers order directly from the confirmation email.
                    Chad Brown

                    Comment


                      #11
                      Re: How did you integrate email send/receive into your web application?

                      SSL question: I suspect this is a necessity to handle email in a web application. Given that a level of security is probably required for such a task. Are there other things I should consider if providing email fetch/send in our web application?

                      ---
                      Sarah
                      Alpha Anywhere latest pre-release

                      Comment


                        #12
                        Re: How did you integrate email send/receive into your web application?

                        You can send things SSL with the A5 client, and anything like Process Them or email2db is going to access mail addresses from an email server, so you have to specify SSL and ports just like you would any other POP/IMAP client.

                        Just in case Chad and I are on a different page than you, Process Them and email2db act as clients of an email server but do not replace the email server itself. You can also run your own email server, but that's a whole other can of worms.

                        Comment


                          #13
                          Re: How did you integrate email send/receive into your web application?

                          Originally posted by christappan View Post
                          You can send things SSL with the A5 client, and anything like Process Them or email2db is going to access mail addresses from an email server, so you have to specify SSL and ports just like you would any other POP/IMAP client.

                          Just in case Chad and I are on a different page than you, Process Them and email2db act as clients of an email server but do not replace the email server itself. You can also run your own email server, but that's a whole other can of worms.
                          I'm not going to run an email server. It's not necessary.

                          Regarding SSL, I am looking more for "this is required and also should probably encrypt Y." I'm not sure what Y would be. Then again, if SSL isn't required... then... I still need to do some extra research outside of Alpha.

                          Your feedback is much appreciated, though! Truthfully. Thank you. :)
                          ---
                          Sarah
                          Alpha Anywhere latest pre-release

                          Comment


                            #14
                            Re: How did you integrate email send/receive into your web application?

                            Y = connection between your app and the email server (connect using SSL if your email server supports SSL)
                            Y also = connection between your user and the application (if you want data sent by your user to the application encrypted)
                            Scott Moniz - Computer Programmer/Analyst
                            REA Inc.
                            http://reainc.net
                            (416)-533-3777
                            [email protected]

                            REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                            If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                            contact us to discuss options.

                            Comment

                            Working...
                            X