Alpha Video Training
Results 1 to 3 of 3

Thread: Garbled email

  1. #1
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,873

    Default Garbled email

    I have a system that generates numerous PDF files and then sends each to specified recipients. The process usually works properly, but occasionally, one of the emails comes out completely garbled. It is as though something hiccuped during the email send process.

    This is what gets sent:
    Sent: Thursday, December 17, 2009 6:09 AM
    To: sxxxxx@verizon.net
    Subject: Tobyhanna PA Pavement Condition Forcast

    ----=_C811abB4F6e6051E3705EEeb36BB0320F45bC2637a54D36b3332a32B0D62C6E0
    Content-Type: text/plain;
    charset="us-ascii"
    Content-Transfer-Encoding: 7bit

    Attached is the Pavement Condition Forcast for Tobyhanna PA



    ----=_C811abB4F6e6051E3705EEeb36BB0320F45bC2637a54D36b3332a32B0D62C6E0
    Content-Type: application/pdf; name="Tobyhanna_PA_Pavement_forcast.pdf"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
    filename="Tobyhanna_PA_Pavement_forcast.pdf"

    JVBERi0xLjMNJf////8NMSAwIG9iag08PA0vVGl0bGUgKP7/AEMAbwBuAGQAaQB0AGkAbwBu
    ACAATABlAHQAdABlAHIAcykNL1Byb2R1Y2VyIChBbXl1bmkgUERGIENvbnZlcnRlciB2ZXJz
    aW9uIDIuNTEtYikNL0NyZWF0aW9uRGF0ZSAoRDoyMDA5MTIxNzA1MzA0MykNPj4NZW5kb2Jq
    DTcgMCBvYmoNPDwgL0xlbmd0aCA4IDAgUiAvRmlsdGVyIC9GbGF0ZURlY29kZSA+Pg1zdHJl
    YW0KeF4zVDAAQkMFQzM9CyAjOZe3kDePy9jCWM/cDCxlbqRgYalnYKJgBhFLzuXS98y1VHDJ
    The encoding mess goes on for quite a while, I just clipped a small sample.
    It is not always with the same pdf file, it is not always to the same recipient.

    The PDF's are all OK, and it just seems to be in the e-mail process.
    This process runs automatically 4 times daily, and it really needs to be correct. It is making my customer rather nervous that the process isn't working 100% correctly.

    Here is the routine that I use to build the PDF's and then mail them. Each report is built and saved to a specified folder, then I loop through a "client" table to send the appropriate PDF to the corresponding e-mail address.
    I needed to put timing delays into the email routine so that the ISP didn't think I was spamming.
    Code:
    Dim text1 as C
    Dim a1[4] as C
    dim L as N
    dim M as N
    dim N as N
    Dim Skip as N
    text1 = get_from_file("C:\FORECAST\timing.txt")
    a1.initialize(text1)
    N = val(a1[1]) 'N is the number 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.
    
    ON ERROR goto ERROR_TEST  'usual error is SMTP timeout.  Wait 90 seconds and try again
    
    dim tbl as P
    Dim tbl2 as P
    tbl = table.open("conditions")
    tbl2 = table.open("clients")
    'goto skipit2
    f1.write_line("Begin Build of Reports at "+time("h:mmAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    
    dim J as N
    Dim loc as C
    J=0
    loc = ""
    
    tbl.fetch_first()
    loc = tbl.Location
    while .not.tbl.fetch_eof()
    	if exist(padr(trim(tbl.Location),35," "),"conditions","Location")
    		pdf_filename = "C:\Forecast\reports"+chr(92)+trim(tbl.location)+"_Pavement_forcast.pdf"
    		if file_exists(pdf_filename)
    			file_remove(pdf_filename)
    		end if
    		filt1 = "location="+quote(trim(tbl.Location))
    		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		
    	tbl.fetch_next()
    	while tbl.Location = loc .and..not.tbl.eof()
    		tbl.fetch_next()
    	end while
    	loc = tbl.Location
    	J=J+1
    end while
    
    f1.write_line(alltrim(str(J-1))+" Reports Built by "+time("h:mmAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    skipit2:
    
    f1.write_line("Begin E-mail of Reports at "+time("h:mmAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    tbl2.index_primary_put("Location")
    tbl2.fetch_first()
    dim I as N
    dim K as N
    J=0
    K=0
    I=0
    h = 0
    'skip anty locations with a blank e-mail address.  Skip the 1st [skip] reports
    while .not.tbl2.fetch_eof()
    	if tbl2.Email_addr = ""
    		statusbar.Set_Text("skipping email report "+strtran(trim(tbl2.location),"_"," "))
    		tbl2.fetch_next()
    	  else
    		if Skip >0
    			while h < Skip
    				tbl2.fetch_next()
    				h = h+1
    			end while
    		end if
    		if I < N 
    			J=J+1
    			I=I+1
    			pdf_filename = "C:\Forecast\reports"+chr(92)+trim(tbl2.location)+"_Pavement_forcast.pdf"
    			msg_text = "Attached is the Pavement Condition Forcast for "+strtran(tbl2.location,"_"," ")
    			param_to = trim(tbl2.Email_addr)
    			param_subject = alltrim(strtran(tbl2.location,"_"," "))+" Pavement Condition Forcast"
    			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))
    			statusbar.Set_Text(alltrim(str(K+I))+" sending email report "+strtran(trim(tbl2.location),"_"," ")+" to "+trim(tbl2.Email_addr))
    			email_Send(param_to,param_subject,param_msg,param_attachments)
    			tbl2.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:mmAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    f1.write_line("*** End Build and e-mail of Reports at "+time("h:mmAM")+" on "+date_format(date(),"Mon-d-yyyy"))
    
    tbl2.close()
    tbl.close()
    
    endit:
    f1.close()
    f1.flush()
    
    'end
    a5.Close()
    
    ERROR_TEST:
    	'wait for 90 seconds and then try the send again
    	SLEEP(90)
    	RESUME 0
    end
    Is it Alpha, or the ISP?

    If anyone has an idea, please let me know.

    Thanks,

    Tom
    Last edited by Tom Henkel; 12-17-2009 at 11:50 AM. Reason: If only I could Type!

  2. #2
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: Garbled email

    Quote Originally Posted by Tom Henkel View Post
    Is it Alpha, or the ISP?
    Safe guess: alpha.
    alpha used to parse long lines by inserting a hard return ( I believe after 65 characters). That was a problem with long URL's and was corrected but maybe it is still a problem with long file names which leads to the garbled stuff.

  3. #3
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,693

    Default Re: Garbled email

    What is being sent is a base64 encoded MIME message. This is the standard way of transporting attachments in email. The "garbled" look is the encoding, and the Content-Type, etc is the MIME formatting.

    Tom, do you have the full headers of one of theses messages available? From what you have posted, it looks like the message itself is correctly formatted and transmitted, but a missing or incorrect header could potentially cause the email reader to not display it properly.

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

Similar Threads

  1. Replies: 1
    Last Post: 05-29-2009, 02:07 AM
  2. Email settings work in Outlook 2003, fail in A5V9 built-in email
    By rmcgaffic in forum Alpha Five Version 9 - Desktop Applications
    Replies: 12
    Last Post: 05-16-2009, 01:56 PM
  3. form field data appears garbled
    By cjlosh in forum Alpha Five Version 7
    Replies: 0
    Last Post: 09-28-2007, 11:05 AM
  4. Replies: 5
    Last Post: 04-28-2007, 09:47 PM
  5. Problem: Database Field Lookup Garbled
    By Denny Johnson in forum Alpha Five Version 4
    Replies: 2
    Last Post: 06-26-2001, 09:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •