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

e-mail send error

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

    e-mail send error

    I have been running this routine now for almost 2 years. In the past week, I'm getting an "Error 1146" when attempting to send pdf files to clients using the below piece of code. It is happening on the first attempt to e-mail.

    Code:
    '*****there is code above this to build the PDF's and to establish the "F1" text file
    f1.write_line("Begin E-mail of Reports at "+time("h:0mAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    email_msg = email_msg + crlf()+"Begin E-mail of Reports at "+time("h:0mAM")+" on "+date_format(date(),"Mon-d-yyyy")
    tblC = table.open("clients")
    'debug(1)
    'ui_msg_box("",text1)
    tblC.index_primary_put("Location")
    tblC.fetch_first()
    dim I as N
    dim K as N
    J=0
    K=0
    I=0
    h = 0
    while .not.tblC.fetch_eof()
    	if tblC.Email_addr = "" .or. marked("clients")
    		statusbar.Set_Text("skipping email report "+strtran(trim(tblC.location),"_"," "))
    		tblC.fetch_next()
    	  else
    		if Skip >0
    			while h < Skip
    				tblC.fetch_next()
    				h = h+1
    			end while
    		end if
    		if I < N 
    			J=J+1
    			I=I+1
    		if tblC.Report_Hdr <>""
    			loc1 = tblC.Report_Hdr
    		  else
    	 	 	loc1 = tblC.location
    		end if	
    
    			pdf_filename = "C:\Forecast\reports"+chr(92)+trim(loc1)+"_Pavement_forecast.pdf"
    			msg_text = "Attached is the Pavement Condition Forecast for "+strtran(loc1,"_"," ")
    			param_to = trim(tblC.Email_addr)
    			param_subject = alltrim(strtran(loc1,"_"," "))+" Pavement Condition Forecast"
    			param_cc = ""
    			param_bcc = ""
    			param_msg = msg_text
    			param_attachments = pdf_filename
    			'traceln(alltrim(str(K+I))+" sending email report "+strtran(trim(tbl1.location),"_"," ")+" to "+trim(tbl1.Email_addr))
    [COLOR="Red"]'************************    HERE IS WHERE IT HAPPENS!   **************************[/COLOR]			
    statusbar.Set_Text(alltrim(str(K+I))+" sending email report "+strtran(trim(loc1),"_"," ")+" to "+trim(tblC.Email_addr))
    			email_Send(param_to,param_subject,param_msg,param_attachments)
    			tblC.fetch_next()
    			sleep(L)
    		  else
    			statusbar.Set_Text("Sleeping for "+alltrim(str(M/60,5,2))+" minutes... DO NOT Disturb!")
    	  		sleep(M)
    			I=0
    			K=K+N
    			'tbl1.fetch_next()
    		end if
    	end if
    end while
    f1.write_line(alltrim(str(J))+" Reports Mailed by "+time("h:0mAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    email_msg = email_msg + crlf()+ alltrim(str(J))+" Reports Mailed by "+time("h:0mAM")+" on "+date_format(date(),"Mon-d-yyyy")
    tblc.close()
    'statusbar.Set_Text("")
    
    endit:
    f1.write_line("*** End Build and e-mail of Reports at "+time("h:0mAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    What I find confusing is that I have a menu that allows me to build the reports and email them via buttons, and that process works using the same data!
    Code:
    Index of Scripts
    ----------------
       1:  auto
         
         
         
    Script Name (   1):  auto
    --------------------------------------------------------------------------------
    'Date Created: 16-Oct-2009 04:02:07 PM
    'Last Updated: 03-Nov-2010 06:58:56 PM
    'Created By  : Thomas Henkel
    'Updated By  : Henkel
    'get timing variables
    'debug(1)
    Dim F1 as P
    Dim text1 as C
    Dim a1[5] as C
    dim L as N
    dim M as N
    dim N as N
    Dim Skip as N
    DIM EM as C = "N"
    text1 = get_from_file("C:\FORECAST\timing.txt")
    a1.initialize(text1)
    N = val(a1[1]) 'N is the nomber of e-mails to do in a batch
    L = val(a1[2]) 'L is the number of seconds to wait after each e-mail
    M = val(a1[3]) 'M is the number of seconds to wait between batches
    Skip = val(a1[4]) 'SKIP is the number of e-mails that had been sent in a previous attempt.
    EM = ut(a1[5])
    ON ERROR goto ERROR_TEST
    'debug(1)
    'f1 is the pointer to a log file so that we have some record of what is happening with each run.
    dim tbl as P
    Dim tbl1 as P
    DIM tblC as P
    DIM repset as P
    'debug(1)
    if file.exists("c:\forecast\replog.txt")
    	f1 = file.open("c:\forecast\replog.txt",FILE_RW_SHARED)
      else
      	f1 = file.create("c:\forecast\replog.txt",FILE_RW_SHARED)
    end if
    endloc = file.size("c:\forecast\replog.txt")
    f1.seek(endloc)
    f1.write_line("")
    f1.write_line("*** Begin Build and e-mail of Reports at "+time("h:mAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    ans2 = ui_msg_box("National Weather Station","Have the reports been Built?",UI_QUESTION_SYMBOL+UI_YES_NO)
    if ans2 = 6
    	goto emailreps
    end if
    repset = set.open("reports")
    tbl = table.get("conditions")
    tbl1 = table.get("clients")
    tbl1.index_primary_put("Location")
    dim J as N
    Dim loc as C = ""
    DIM loc1 as C = ""
    J=0
    
    'PleaseWait(.T.,"Building Reports...")
    REPSET.fetch_first()
    loc = tbl.Location
    loc2 = tbl1.Report_Hdr
    while .not.REPSET.fetch_eof()
    	if tbl1.Report_Hdr <>""
    		loc1 = tbl1.Report_Hdr
    	  else
    	  	loc1 = tbl.location
    	end if	
    	
    	if exist(padr(trim(tbl.location),35," "),"conditions","Location")
    		pdf_filename = "C:\Forecast\reports"+chr(92)+trim(loc1)+"_Pavement_forecast.pdf"
    		if file_exists(pdf_filename)
    			file_remove(pdf_filename)
    		end if
    		dim rec_no as N
    		recno = tbl1.recno()
    		filt1 = "location="+quote(trim(tbl.Location))+".and. report_hdr = "+quote(loc2)
    		query.filter = filt1
    		query.order = ""
    		'report.preview("Condition Letters",query.filter,query.order)
    		report.SaveAs("Condition Letters","PDF",query.filter,query.order,pdf_filename)
    	end if		
    	repset.fetch_next()
    	while tbl.Location = loc .and. tbl1.report_hdr = loc2  .and. .not.REPSET.fetch_eof()
    		repset.fetch_next()
    	end while
    	loc = tbl.Location
    	loc2 = tbl1.report_hdr
    	J=J+1
    end while
    PleaseWait()
    f1.write_line(alltrim(str(J-1))+" Reports Built "+time("h:0mAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    
    ui_msg_box("Note",alltrim(str(J-1))+" Reports Built")
    
    repset.close()
    'tbl1.close()
    'tbl.close()
    debug(1)
    'PleaseWait(.T.,"E-Mailing Reports...")
    emailreps:
    tblC = table.open("clients")
    'debug(1)
    'ui_msg_box("",text1)
    tblC.index_primary_put("Location")
    tblC.fetch_first()
    dim I as N
    dim K as N
    J=0
    K=0
    I=0
    h = 0
    while .not.tblC.fetch_eof()
    	if tblC.Email_addr = ""
    		statusbar.Set_Text("skipping email report "+strtran(trim(tblC.location),"_"," "))
    		tblC.fetch_next()
    	  else
    		if Skip >0
    			while h < Skip
    				tblC.fetch_next()
    				h = h+1
    			end while
    		end if
    		if I < N 
    			J=J+1
    			I=I+1
    		if tblC.Report_Hdr <>""
    			loc1 = tblC.Report_Hdr
    		  else
    	 	 	loc1 = tblC.location
    		end if	
    
    			pdf_filename = "C:\Forecast\reports"+chr(92)+trim(loc1)+"_Pavement_forecast.pdf"
    			msg_text = "Attached is the Pavement Condition Forecast for "+strtran(loc1,"_"," ")
    			param_to = trim(tblC.Email_addr)
    			param_subject = alltrim(strtran(loc1,"_"," "))+" Pavement Condition Forecast"
    			param_cc = ""
    			param_bcc = ""
    			param_msg = msg_text
    			param_attachments = pdf_filename
    			statusbar.Set_Text(alltrim(str(K+I))+" sending email report "+strtran(trim(loc1),"_"," ")+" to "+trim(tblC.Email_addr))			                 			email_Send(param_to,param_subject,param_msg,param_attachments)
        			tblC.fetch_next()
    			sleep(L)
    		  else
    			statusbar.Set_Text("Sleeping for "+alltrim(str(M/60,5,2))+" minutes... DO NOT Disturb!")
    	  		sleep(M)
    			I=0
    			K=K+N
    			'tbl1.fetch_next()
    		end if
    	end if
    end while
    PleaseWait()
    f1.write_line(alltrim(str(J-1))+" Reports Mailed by "+time("h:0mAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    
    ui_msg_box("Note",alltrim(str(J))+" Reports Mailed")
    tblC.close()
    'tbl.close()
    f1.flush()
    f1.close()
    end
    'a5.Close()
    
    ERROR_TEST:
    	SLEEP(90)
    	RESUME 0
    	
    end
    
    	  
    End Script (   1)---------------------------------------------------------------
    Any help would be appreciated.

    Tom
    Last edited by Tom Henkel; 03-15-2011, 09:01 AM. Reason: additional info

    #2
    Re: e-mail send error

    There's nothing there visible to generate an unhandled exception. Have you examined the data? What happened when you commented out the statusbar line and used the traceln() you tried?
    There can be only one.

    Comment


      #3
      Re: e-mail send error

      The data is fine. I've marked the "first" record, and it then fails on the "second".

      When I run it through the button instead of using the autoexec script, all the e-mails go out!

      This is an automated process that runs every 6 hours to take a file from a website, import the data into a table, then produce PDF reports of that data. Once the reports are built, they are emailed to specific e-mail addresses associated with each report.

      The autoexec script has been running for 2 years now. The source data hasn't changed, and the tables to build the PDF's looks correct.

      When I close the program, I am getting a very odd memory fault error. Could it be that some place in memory has gone bad, and that this program just happens to hit it?

      Tom

      Comment


        #4
        Re: e-mail send error

        4 thingsTom, more questions than answers I'm afraid.

        1) has the web site included some unprintable characters in the page which the "button push" gets around? You won't necessarily notice any physical differences.
        2) what happens when you try running another programme at the same time and taking up the memory?
        3) what happens if you replace the autoexe with the button script?
        4) have you installed a later version of Adobe which has corrupted summat?
        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


          #5
          Re: e-mail send error

          Ted,

          Thanks for the questions.

          1. No. the website just sends a csv file that we import. If there was something weird there, it would blow up when we try to create the tables.

          2. interesting idea. Not really sure how to accomplish that as I mostly work on the machine remotely. I'll give it a try, though.

          3. The code in the autoexec is similar enough to the button code that I really don't want to mess with it. I just try to produce an e-mail to myself letting me know that the process ran or that there are errors.

          4. I haven't installed anything. But wouldn't the system blow up when we build the report PDF's, not when we attempt to send them?

          Tom

          Comment


            #6
            Re: e-mail send error

            Just an update.

            The routine runs on a client's machine with runtime as the engine. I don't have the ability to directly edit the scripts for debugging. I did export the "manual" script and noticed that it had the "email_send()" commented out. When I un-commented it and imported the script back into the application, it failed as well.

            I checked the settings for e-mail, and I am using the built in email , not the external client. When I tested the profile, all worked well, however, email_send is hanging up.

            I am running the latest patch of v9. I looked at the patch history and noticed that 2 or 3 of the latest patches for 9 had something to do with e-mail. I am thinking of falling back a few to see if that resolves it.

            I may also just jump to v10 runtime and see where that takes me.

            Tom

            Comment


              #7
              Re: e-mail send error

              This has the smell of a timing issue allover it.
              Yes it worked for 2 years, but now.. the table is bigger..
              Allow more time in your script between records.

              Comment


                #8
                Re: e-mail send error

                Gabe,
                Sorry to disappoint you, but the table has remained consistent for the past 6 or 7 months. In fact, the number of e-mails has actually decreased.

                This happens with any e-mail from alpha. I have a routine at the beginning of the script that tests for new data. If there is no new data, I e-mail a message to myself that the data did not download for this run. THAT message hung up the system.

                I've asked the client if anything has changed, and he said no. I've checked and nothing looks different.

                This process is seasonal. We send these reports to clients from October to April. Why did it have to crap out 2 weeks before we were done for the year???:(

                Comment


                  #9
                  Re: e-mail send error

                  The size of the table is only one factor.. your connection speed!
                  Without delving too much into this, it just sounds like a timing issue.
                  Just increase the delay between the records and see what happens.

                  Comment


                    #10
                    Re: e-mail send error

                    Interesting update.

                    I ran this process from my home computer and it ran. e-mails went out and it didn't hiccup.

                    The machine at the location is connected to the internet via a business cable modem. It is very high speed.

                    I ran some diagnostic routines on that machine last night, and there were many issues with the system itself. The client and I have agreed to shutdown the runs because it is getting late in the season anyway. I am going to try to do a couple of runs this weekend just to see if the cleanup fixed things.

                    Tom

                    Comment


                      #11
                      Re: e-mail send error

                      This is for Ted.

                      4) have you installed a later version of Adobe which has corrupted summat?
                      I don't know. I know that an update to adobe was pending, I don't know if they installed it. If so, how would I get back to the old one.

                      The reason I am asking is that When the routine fails, it sends an e-mail to me (text only) and that does seem to work.

                      Tom

                      Comment


                        #12
                        Re: e-mail send error

                        Previous versions
                        There can be only one.

                        Comment


                          #13
                          Re: e-mail send error

                          Thanks, Stan.

                          We'll give it a shot.

                          Tom

                          Comment

                          Working...
                          X