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

Email sends in Preview but not when published

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

    Email sends in Preview but not when published

    Howdy folks, the code below sends an email when executed in Working Preview, but not when I publish to the web server. Can anyone suggest why? :) Many thanks,

    Code:
     
    dim ok as N
    
    	ok = email_send("[email protected]","test","test","","","","","","","wilsong")
    	
    	if ok then
    		e.javascript = "alert('Email sent.');"
    	else
    		e.javascript = "alert('User " + js_escape(pUser.userid) + " unable to send email.');"
    	end if
    'end if

    #2
    Re: Email sends in Preview but not when published

    difficult to diagnose and tell where it fails.
    1> did you set up the email settings in the server as you did in your development machine?
    2> did you send a test email from the server and did it work?

    ok = email_send("[email protected]","test","test","","","","","","","wilsong") shouldn't be like this below?

    ok = email_send("[email protected]","test","test","","","",.t.,"","","wilsong")
    is wilsong your profile name, if so did you set it up in the server too, as such?
    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


      #3
      Re: Email sends in Preview but not when published

      Hi Gandi, I've not come across anything that mentions setting up in two locations (development machine and the server), only the development machine. That would explain the scenario. Wilsong is the profile name and I did try it as you suggested but that also failed.

      How do you set these up on the server?

      Many thanks

      Comment


        #4
        Re: Email sends in Preview but not when published

        two locations (development machine and the server),
        if your server is located in the development machine then that is it. no need to setup differently.
        if email is working properly on working preview but not when published, since the setting is same, it is odd.
        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


          #5
          Re: Email sends in Preview but not when published

          The publish server is different to my development machine so could that be the cause? It works in the preview on my dev machine but not when published.

          Comment


            #6
            Re: Email sends in Preview but not when published

            so that's what I thought in the first place, then I was confused with your second question.
            so set up the email settings and publish all the files to the server then it should work.
            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


              #7
              Re: Email sends in Preview but not when published

              I thought I did publish everything but must not have...I'll try again

              Comment


                #8
                Re: Email sends in Preview but not when published

                I must be missing something...

                I have the email profiles created in the app on my Dev machine.
                Emails are sent when in Preview on Dev.
                Once I publish all to the web server, email doesn't send, no errors, nothing.

                My profiles are not being published.

                Comment


                  #9
                  Re: Email sends in Preview but not when published

                  Ok one little thing.
                  On the top there is profile button, when you click it will show all defined profiles.
                  Alpha comes with local profile to be used for local host that is your development machine.
                  Did you setup one for the server with path alias etc, and if you did are you publishing to that profile?
                  When you publish you can drop down to that profile to publish.
                  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


                    #10
                    Re: Email sends in Preview but not when published

                    I'm publishing to a different profile I created for the web server. I use sql tables so path alias = undefined. Are the email profiles stored in a dbf table, so that's why I can't publish them, maybe?

                    Comment


                      #11
                      Re: Email sends in Preview but not when published

                      I do not know why then.
                      But you could stop the server and restart.
                      When in doubt..
                      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


                        #12
                        Re: Email sends in Preview but not when published

                        Thanks for your help anyway, Gandhi. I've resorted to using email_send() instead and retrieve the smtp details via stored procedure.

                        The benefit of others, this works...

                        Code:
                        dim pm as P
                        dim ps as P
                        
                        if (email_smtp_open(ps, "smtp_server", port_number, "login", "password","SSL")) then
                        
                            pm.to = "[email protected]"
                            pm.from = "[email protected]"
                            pm.subject = "smtp_open test"
                            pm.message = "this is the message"
                            pm.attachments = <<%str%
                        				        C:\test.txt
                        				        %str%
                        
                            'pm.html_message = "This is the message in HTML"
                        
                            email_smtp_send(pm, ps)
                        	
                        	e.javascript = "alert('Email sent.');"
                        	
                        end if
                        
                        email_smtp_close(ps)

                        Comment


                          #13
                          Re: Email sends in Preview but not when published

                          I am happy it worked out for you.
                          just to see
                          I tested the way I suggested in post #2
                          ok = email_send("[email protected]","test","test","","","",.t.,"","","wilsong")
                          replacing my profile name for wilsong,
                          and the email was sent.
                          so I do not know what was the problem.
                          as long as it is resolved that's all it matters.
                          ps:
                          (also the way you ended up doing is the way I send email and as well as using javascript.)
                          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


                            #14
                            Re: Email sends in Preview but not when published

                            Cheers.

                            Hopefully one day I won't encounter bugs or glitches with everything I try.

                            Good to hear that my final method is working well. It has turned out for the better as it can all be managed from the sql server, negating the need to re-publish anything :)

                            XBASIC FUNCTION:
                            Code:
                            function ReturnSMTP as P(UserID as C,GroupGUID as C)
                            	'debug(1)	
                            	dim cn as sql::Connection
                            	dim rs as sql::ResultSet
                            	dim args as sql::Arguments
                            	dim ok as l
                            	
                            	args.Add("UserID",UserID)
                            	args.Add("GroupGUID",GroupGUID)
                            	
                            	ok = cn.Open("::Name::OpenStaff")
                            	if ok then
                            		ok = cn.Execute("slEmailSettings :UserID,:GroupGUID",args)
                            		if ok then
                            			rs = cn.ResultSet
                            			ReturnSMTP.Server = rs.data(1)
                            			ReturnSMTP.Port = rs.data(2)
                            			ReturnSMTP.Login = rs.data(3)
                            			ReturnSMTP.Password = rs.data(4)
                            			ReturnSMTP.Encryption = rs.data(5)
                            			ReturnSMTP.Address = rs.data(6)
                            			ok = cn.Close()
                            		end if
                            	end if	
                            	
                            end function
                            NEW SERVER-SIDE SUBMIT:
                            Code:
                            dim pm as P
                            dim ps as P
                            Dim pUser as P
                            dim settings as P
                            
                            a5ws_logged_in_user_values(pUser)
                            
                            settings = ReturnSMTP(pUser.userid,session.GroupGUID)
                            
                            if (email_smtp_open(ps, settings.Server,convert_type(settings.Port,"N"),settings.Login, settings.Password,settings.Encryption)) then
                                pm.to = e.dataSubmitted.email_to '"[email protected]"
                                pm.from = settings.Address
                                pm.subject = e.dataSubmitted.subject
                               ' pm.message = e.dataSubmitted.message
                               ' pm.attachments = <<%str%
                            	'			        C:\test.txt
                            		'		        %str%
                            
                                pm.html_message = e.dataSubmitted.message
                            
                                email_smtp_send(pm, ps)
                            	
                            	e.javascript = "alert('Email sent.');"  + crlf() + "$('{dialog.ComponentName}.V.R1.BUTTON_CLOSE').click();" 
                            	
                            	email_smtp_close(ps)
                            else
                            	e.javascript = "alert('Failed. Email not sent.');"
                            end if

                            Comment


                              #15
                              Re: Email sends in Preview but not when published

                              I am happy it worked out for you.
                              just to see
                              I tested the way I suggested in post #2
                              ok = email_send("[email protected]","test","test","","","",.t.,"","","wilsong")
                              replacing my profile name for wilsong,
                              and the email was sent.
                              so I do not know what was the problem.
                              as long as it is resolved that's all it matters.
                              ps:
                              (also the way you ended up doing is the way I send email and as well as using javascript.)
                              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

                              Working...
                              X