Just renamed for archive searching purposes...Thanks for sharing, Jack!

On 3/26/2012 6:40 PM, Jack Skelley wrote:
> Good Evening Mike:
> The email portion runs against a table of contacts with checkboxes to 
> determine who gets what mail. I do a tomato mailing about 6 times a year that 
> basically talks about my hose timer controlled drip fertigation system where 
> the tomato plants are in 5 gallon spackle buckets.
> The salmon fly mailing is sent to 240+ recipients in 9 countries every week 
> (usually on Tuesday).
> The email section uses CDO (collaborative data objects) wrapped around my 
> gmail account primarily. But I have 3 other accounts that I can select in an 
> optionbutton. On the form I have a listbox with a mover that enables me to 
> drag and drop from either Windows Explorer or my Olympus photo editor that 
> came with one of my cameras. All emails are sent as individual emails. The 
> text section of the email is written in MS Word and dragged and dropped into 
> the editbox. The document is saved as a as a Word doc and the email is saved 
> to a VFP table with attachments and recipients. There is a resend function 
> incase there is a Gmail issue to all or to selected individuals. I can refer 
> to any email sent in the system and reuse any or all parts of it.
> The email method mails 1/2 the recipient list then waits 20 minutes to mail 
> the other half. I wait 5 seconds between emails. Google has locked my account 
> when I sent all email as fast as it would go (depends on the size and number 
> of attachments - usually jpgs of salmon and flies). So now the pacing 
> function doesn't seem to be an issue with Google. They would lock the account 
> for several hours when they 'thought' I was using their mailer as a spam 
> engine. I guess some would think the fly mailing is spam!<bg>  But the 
> recipients all atlantic salmon/steelhead zealots like me!
> Here is the send code:
>
> LOCAL objCDOSYSMail, objCDOSYSCon, i, lbBlind_CC, lcSent_via
> LOCAL lnTime_to_send, lnWait_time, lnStart_time, lnEnd_Time
> lnWait_time = 5
> IF NOT gbSpaces_stripped THEN
>    thisform.edtNotes.Value = thisform.strip_spaces(thisform.edtNotes.Value)
>    thisform.edtNotes.Refresh()
>    gbSpaces_stripped = .t.
> ENDIF
> objCDOSYSMail = CreateObject("CDO.Message")
> objCDOSYSCon =  CreateObject ("CDO.Configuration")
> **********************************************************************************
> DO CASE
>    CASE thisform.cntShow_grid.optWhich_account.Value = 1&&NJ Devils Email...
>    CASE thisform.cntShow_grid.optWhich_account.Value = 2&&Optonline Email...
>    CASE thisform.cntShow_grid.optWhich_account.Value = 3&&GMail Email - 
> default account...
>      
> objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername";)
>  = "Your UserName"
>      
> objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword";)
>  = "Your PassWord"
>      
> objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver";)
>  = "smtp.gmail.com"
>      
> objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing";)
>  = 2
>      
> objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport";)
>  = 465
>      
> objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";)
>  = 1
>      
> objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl";)
>  = 1
>      
> objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout";)
>  = 60
>      objCDOSYSCon.Fields.update
>      objCDOSYSMail.From = "Jack Skelley<[email protected]>"
>      lcSent_via = CHR(13) + CHR(10) + "Sent Via Gmail..."
> ENDCASE
> **********************************************************************************
> objCDOSYSMail.Configuration = objCDOSYSCon
> objCDOSYSMail.ReplyTo = "Jack Skelley<[email protected]>"
> objCDOSYSMail.Subject = ALLTRIM(thisform.txtSubject.Value)
> objCDOSYSMail.TextBody = ALLTRIM(thisform.edtNotes.Value) + IIF(gbSent_via, 
> lcSent_via, "")
> ********************************************************************************
> IF thisform.lstAttachments.ListCount>  0 THEN
>    FOR i = 1 TO thisform.lstAttachments.ListCount
>      objCDOSYSMail.AddAttachment(ALLTRIM(thisform.lstAttachments.List(i, 2)) 
> + ALLTRIM(thisform.lstAttachments.List(i, 1)))&&path + filename
>    ENDFOR
> ELSE
>    WAIT WINDOW "No Attachments Found..." TIMEOUT 1
> ENDIF
> **********************************************************************************
> IF gbBlind_CC THEN
>    objCDOSYSMail.BCC = "[email protected]"
>    lbBlind_CC = .t.
> ELSE
>    lbBlind_CC = .f.
> ENDIF
> **********************************************************************************
> thisform.cntEmail.Top = 217
> thisform.cntEmail.Left = 160
> thisform.cntEmail.lstEmail.Clear()
> thisform.cntEmail.txtCurrent_time.Value = TIME()
> thisform.cntEmail.txtCurrent_time.Refresh()
> thisform.cntEmail.Visible = .t.
> thisform.tmrTime.enabled = .t.
> SELECT tView
> GO TOP
> thisform.cntEmail.txtStart.Value = TIME()
> thisform.cntEmail.txtStart.Refresh()
> thisform.cntEmail.txtEnd.Value = "Sending..."
> thisform.cntEmail.txtEnd.Refresh()
> DO CASE
>    CASE gnSeq_num_email<= 0&&this is for flymailing, tomato emails and 
> multiple emails...
>      IF gnResume_record>  0 THEN&&the error handler save the record that did 
> not send and resume at that spot when Gmail thought this was a spam engine
>        GO RECORD gnResume_record
>        gnResume_record = 0
>      ENDIF
>      SCAN FOR flymailing REST&&only send email to checked recipients...fly 
> mailing, tomato mailing or multiple recipients...
>        lnStart_time = SECONDS()
>        WAIT WINDOW "Sending Email To: " + UPPER(ALLTRIM(tView.email)) + "..." 
> NOWAIT
>        objCDOSYSMail.To = ALLTRIM(tView.email)
>        objCDOSYSMail.Send()&&send the email
>        IF gbAbort_email_send THEN
>          gnResume_record = RECNO('tView')
>          RETURN
>        ENDIF
>        IF lbBlind_CC then
>           lbBlind_CC = .f.&&but keep the public version as it is as it is 
> hooked to the checkbox...
>           objCDOSYSMail.BCC = ""&&only send 1 blind CC...
>        ENDIF
>        thisform.cntEmail.lstEmail.AddItem(ALLTRIM("Sent To: " + 
> tView.lfname), thisform.cntEmail.lstEmail.ListCount + 1, 1)
>        thisform.cntEmail.lstEmail.ListIndex = 
> thisform.cntEmail.lstEmail.ListCount
>        thisform.cntEmail.lstEmail.List(thisform.cntEmail.lstEmail.ListIndex, 
> 2) = ALLTRIM(tView.email)
>        gnEmails_sent = gnEmails_sent + 1
>        thisform.cntEmail.txtEmails_sent.Refresh()
>        thisform.cntEmail.lstEmail.ListIndex = 
> thisform.cntEmail.lstEmail.ListCount
>        lnEnd_Time = SECONDS()
>        lnTime_to_send = lnEnd_time - lnStart_time
>        thisform.cntEmail.txtTime_to_send.value = lnTime_to_send
>        thisform.cntEmail.txtTime_to_send.refresh()
>        WAIT WINDOW "Sent Email To: " + UPPER(ALLTRIM(tView.email)) + 
> "...Waiting..." TIMEOUT lnWait_time
>      ENDSCAN
>    OTHERWISE&&only for 1 email to be sent...
>      lnStart_time = INT(SECONDS())
>      WAIT WINDOW "Sending Email To: " + UPPER(ALLTRIM(tView.email)) + "..." 
> NOWAIT
>      objCDOSYSMail.To = ALLTRIM(tView.email)
>      objCDOSYSMail.Send()
>      IF gbAbort_email_send THEN
>        gnResume_record = RECNO('tView')
>        RETURN
>      ENDIF
>      IF lbBlind_CC then
>         lbBlind_CC = .f.&&but keep the public version as it is as it is 
> hooked to the checkbox...
>         objCDOSYSMail.BCC = ""&&only send 1 blind CC...
>      ENDIF
>      thisform.cntEmail.lstEmail.AddItem(ALLTRIM("Sent To: " + tView.lfname), 
> thisform.cntEmail.lstEmail.ListCount + 1, 1)
>      thisform.cntEmail.lstEmail.ListIndex = 
> thisform.cntEmail.lstEmail.ListCount
>      thisform.cntEmail.lstEmail.List(thisform.cntEmail.lstEmail.ListIndex, 2) 
> = ALLTRIM(tView.email)
>      gnEmails_sent = gnEmails_sent + 1
>      thisform.cntEmail.txtEmails_sent.Refresh()
>      thisform.cntEmail.lstEmail.ListIndex = 
> thisform.cntEmail.lstEmail.ListCount
>      lnEnd_Time = INT(SECONDS())
>      lnTime_to_send = lnEnd_time - lnStart_time
>      thisform.cntEmail.txtTime_to_send.value = lnTime_to_send
>      thisform.cntEmail.txtTime_to_send.refresh()
> ENDCASE
> thisform.cntEmail.txtEnd.Value = ""
> thisform.cntEmail.txtEnd.Refresh()
> thisform.cntEmail.txtEnd.Value = TIME()
> thisform.cntEmail.txtEnd.Refresh()
> thisform.Refresh()
> WAIT CLEAR
> DOEVENTS
> objCDOSYSMail = null
> objCDOSYSCon = null
>
>
> This could be cleaned up but it works very well.
> Happy to answer any other questions you may have.
> Best regards,
>
> Jack
>
>
>
> Jack Skelley
> Senior Director, Programming/Computer Operations
> New Jersey Devils
> (973)757-6164

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to