Alpha Video Training
Results 1 to 16 of 16

Thread: Bulk Emailer - Here it is!

  1. #1
    Member mvaughn's Avatar
    Real Name
    Michael Vaughn
    Join Date
    Aug 2012
    Location
    Longview, Texas, USA
    Posts
    703

    Default Bulk Emailer - Here it is!

    I needed a bulk emailer and decided to write my own.
    I wanted it to be short and simple and to the point,
    and this is what I came up with. It's pretty basic but the main
    engine is in place and tested.

    And in the spirit of Open Source, I am giving it away to use as you like.
    All I ask is that if you do improve on it that you will keep my name
    in the function credits and post your version here for others to do
    the same.

    http://ablejobs.us/bulk_emailer.zip

  2. #2
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Bulk Emailer - Here it is!

    Michael,

    Very nice code. How does it get the email setup properties?
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  3. #3
    Member mvaughn's Avatar
    Real Name
    Michael Vaughn
    Join Date
    Aug 2012
    Location
    Longview, Texas, USA
    Posts
    703

    Default Re: Bulk Emailer - Here it is!

    Quote Originally Posted by Keith Hubert View Post
    Michael,

    Very nice code. How does it get the email setup properties?
    In this line:
    IF (email_smtp_open(ps, "smtp.gmail.com",465,"office.ablejobs@gmail.com","PASSWORD","SSL")) THEN

    server-port-username-password-encryption

  4. #4
    Member mvaughn's Avatar
    Real Name
    Michael Vaughn
    Join Date
    Aug 2012
    Location
    Longview, Texas, USA
    Posts
    703

    Default Re: Bulk Emailer - Here it is!

    I received these helpful tips from JerryBrightbill that you should consider. As I mentioned above this program is basic and was intended to be a foundation for which you can build onto to suit your needs.

    Mike

    Having built a high volume bulk emailer a few years ago that would sent 1200 identical emails in a few minutes, I learned there are a few surprises that may trip up your process.

    Most email providers have limits to throttle bulk email as a spam deterrent. Many of these are hidden or undocumented. The penalties are also often not fully documented. Most limit the number of emails in a given period, and the number of addresses that can be placed in to:, cc:, and bcc: per email. Here are some links with some published numbers

    http://support.e-zekiel.com/template...06&fetch=26546

    http://www.emailaddressmanager.com/t...ate-limit.html

    What is often not published is the number of connections per minute, and the number of emails per connection which are both often restricted. A few years ago, many providers had a limit of 3-5 connections per minute, although evidence suggests that has changed.

    With any "bulk" type email process it isn't hard to exceed the limits, especially if you open and close a connection for each email.

    The real penalty is how the provider responds if you hit the limit. If you look at the links above, Comcast effectively locks sending emails for 24 hours. Some years ago AOL had a similar policy except it froze the entire email account for 24 hours. You couldn't send or receive. In addition, violate the policy too often and some providers will cancel the account and label you as a spam provider. The providers constantly monitor and tweak the limits to prevent spam which makes pushing the limits even more chancy.

    My suggestion would be to carefully investigate the providers email policies concerning volume and add some throttling mechanism to the code that generates the emails in a manner that won't hit the limits.

    Either that or use some bulk email service that doesn't limit the emails or has very high limits

  5. #5
    Member mvaughn's Avatar
    Real Name
    Michael Vaughn
    Join Date
    Aug 2012
    Location
    Longview, Texas, USA
    Posts
    703

    Default Re: Bulk Emailer - Here it is!

    As soon as I have some time I will post an upgrade that will include a dbf for a queue and logic to take care of the send quotas.
    Last edited by mvaughn; 02-07-2013 at 06:29 PM.

  6. #6
    Member
    Real Name
    Robert Earl Allin
    Join Date
    Apr 2009
    Location
    Toronto, Ontario
    Posts
    241

    Default Re: Bulk Emailer - Here it is!

    Glad to hear it.

  7. #7
    Member
    Real Name
    Holly Yon
    Join Date
    Oct 2012
    Location
    Orlando, FL
    Posts
    71

    Default Re: Bulk Emailer - Here it is!

    When I go to the link I am getting a 404 message....? Did you remove it? I hope not because I could really use something like this.

    Thanks for all your hard work!

    Holly

  8. #8
    Member mvaughn's Avatar
    Real Name
    Michael Vaughn
    Join Date
    Aug 2012
    Location
    Longview, Texas, USA
    Posts
    703

    Default Re: Bulk Emailer - Here it is!

    Ooops, was cleaning out the webroot and accidently deleted it. It's back now :)
    By adjusting the sleep() value you can have it send so many per hour.
    sleep(36) will send 100 per hour.
    Last edited by mvaughn; 02-10-2013 at 01:56 PM.

  9. #9
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,091

    Default Re: Bulk Emailer - Here it is!

    is it possible to use this with a dbf table? if yes how can i get list of email addresses from my .dbf table in to the record set.

    Code:
    '=======================SQL CONNECT=====================
    IF conn.open("::NAME::XXXXXXX") THEN
    	conn.PortableSQLEnabled = .t.
    	conn.execute("SELECT DISTINCT add_email FROM appdata1")						'** add_email is my column name
    	rs = conn.ResultSet													'** appdata1 is my table name
    END IF
    thanks

  10. #10
    Member
    Real Name
    Dave
    Join Date
    Jul 2012
    Location
    Southern California
    Posts
    621

    Default Re: Bulk Emailer - Here it is!

    Michael,

    Very nice! You can optionally use a5_is_email_valid() as opposed to *any() to verify if the email address is valid. It checks for more than just a single (@). a5_email_valid() has been deprecated.

  11. #11
    Member mvaughn's Avatar
    Real Name
    Michael Vaughn
    Join Date
    Aug 2012
    Location
    Longview, Texas, USA
    Posts
    703

    Default Re: Bulk Emailer - Here it is!

    Nice tip Dave!
    I was just looking for an "@" but I have seen some people submit "yahooo.com", "hotmail. com" etc etc.

  12. #12
    Member mvaughn's Avatar
    Real Name
    Michael Vaughn
    Join Date
    Aug 2012
    Location
    Longview, Texas, USA
    Posts
    703

    Default Re: Bulk Emailer - Here it is!

    Richard, porting this to DBF is easy.
    You are on the right track.

    conn.execute("SELECT DISTINCT emailaddy FROM table")
    rs = conn.ResultSet
    while rs.nextrow
    email = rs(0)
    ...

  13. #13
    Member
    Real Name
    pieter cremers
    Join Date
    Nov 2009
    Location
    Netherlands
    Posts
    146

    Default Re: Bulk Emailer - Here it is!

    Hi Michael,

    I have been trying to download this file but after downloading the zip file is "not valid".
    Is it possible to get this file in another way?

    tia

    Pieter

  14. #14
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,617

    Default Re: Bulk Emailer - Here it is!

    Quote Originally Posted by info@computoria.nl View Post
    Hi Michael,

    I have been trying to download this file but after downloading the zip file is "not valid".
    Is it possible to get this file in another way?

    tia

    Pieter
    Me too..
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  15. #15
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,653

    Default Re: Bulk Emailer - Here it is!

    Yep, the zip's corrupt.

  16. #16
    Member mvaughn's Avatar
    Real Name
    Michael Vaughn
    Join Date
    Aug 2012
    Location
    Longview, Texas, USA
    Posts
    703

    Default Re: Bulk Emailer - Here it is!

    Sorry about the zip. Here is the code:

    Code:
    function sendemail as c (e as p)
    	
    '***********************************************************************************'
    'PURPOSE: LOOP THROUGH A COLUMN OF EMAIL ADDRESSES AND SEND A CUSTOM MESSAGE TO ALL '
    'AUTHOR: MICHAEL VAUGHN																			 '
    'EMAIL: MVAUGHN75601@GMAIL.COM																	 '
    'DATE: 02/01/2013																				 	 '
    'LICENSE: OPEN SOURCE																				 '
    '***********************************************************************************'
    
    DEBUG(1)
    
    ON ERROR GOTO ER
    
    dim nCount as N
    dim result as L
    dim pm as P
    dim ps as P
    dim ef as C = e.dataSubmitted.from
    dim es as C = e.dataSubmitted.subject
    dim em as C = e.dataSubmitted.message
    dim conn as SQL::Connection
    dim rs as SQL::ResultSet
    
    '=======================SQL CONNECT=====================
    IF conn.open("::NAME::XXXXXXX") THEN
    	conn.PortableSQLEnabled = .t.
    	conn.execute("SELECT DISTINCT add_email FROM appdata1")						'** add_email is my column name
    	rs = conn.ResultSet																		'** appdata1 is my table name
    END IF
    '=======================EMAIL LOOP======================
    WHILE rs.nextrow()
    	IF (email_smtp_open(ps, "smtp.gmail.com",465,"your_email@gmail.com","YOUR_PASSWORD","SSL")) THEN
    		pm.from = alltrim(ef)
    		pm.subject = alltrim(es)
    		pm.message = alltrim(em)
    		pm.to = alltrim(rs.Data("add_email"))											'** Column Name
    		IF *any(pm.to, "@")THEN
    			'save_to_file(pm.to + " " + crlf(),"c:\Email Addresses.txt",.t.)	'** TOGGLE ON FOR TESTING
    			result = email_smtp_send(pm, ps)											'** TOGGLE OFF FOR TESTING
    			FOR nCount = 1 to 5																'** Retry Send if needed
    				IF result = .t. THEN
    					EXIT FOR
    				END IF
    				result = email_smtp_send(pm, ps)										'** TOGGLE OFF FOR TESTING
    			NEXT nCount
    			email_smtp_close(ps)															'** TOGGLE OFF FOR TESTING
    			SLEEP(2)																			'** Be nice to the server
    		END IF										
    	END IF
    END WHILE
    conn.close()
    sendemail = "alert('Your task has completed');"
    exit function	
    '=======================ERROR HANDLER===================
    ER:
    sendemail = "alert('" + conn.CallResult.text + "');"							'** If you see only "Success" there was a problem
    conn.close()																				'** within the loop
    email_smtp_close(ps)																	'** TOGGLE OFF FOR TESTING	
    end function

Similar Threads

  1. default emailer in Alpha5 v10 and Windows 7
    By jdoyle in forum Alpha Five Version 10 - Desktop Applications
    Replies: 4
    Last Post: 12-23-2009, 07:08 PM
  2. Web bulk emailer
    By JH10 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 4
    Last Post: 11-06-2009, 03:33 PM
  3. Alpha v8 Emailer Hangs on Looking for Emails
    By Ant-Tech in forum Alpha Five Version 8
    Replies: 0
    Last Post: 03-30-2007, 07:10 AM
  4. A5 Internal emailer problem #2
    By brett s in forum Alpha Five Version 5
    Replies: 8
    Last Post: 07-15-2004, 05:42 PM
  5. Bulk Email?
    By Keith Hubert in forum Alpha Five Version 5
    Replies: 5
    Last Post: 03-12-2003, 05:11 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
  •