p3consulting
Joined: 03 Mar 2007 Posts: 1
|
Posted: Sat Mar 03, 2007 1:39 pm Post subject: Sharing a little solution to some problems… |
|
|
As some recurrent questions in this forum show up, it's not always simple to send mass mailing from to regular ISP connection…
So let's share here how we solved the situation for ourselves:
Since we have our own dedicated servers, we decide to take the route to use these instead of the personal workstations.
However, Maxbulk doesn't run on these machines so we had to invent a way to make the Maxbulk files usable on the servers.
We choose to use a script language with enough regular expression parsing features and we go with Ruby (we could have use Python or Perl…).
What we have done basically is to write a Ruby script able to parse the Maxbulk saved files and interpret the original macro syntax and generate the mailing as expected when running Maxbulk on a workstation.
The mailing is generated by the script as a bash script ready to be executed, (using the Unix mail command for the actual delivery).
So we now have the choice to pipe the output of the script directly into the bash interpreter or in a text file for later execution.
What about attached files if any ?
We just have to put them on the server along with the Maxbulk file and the Ruby script take them into account automatically.
By doing so, we eventually got the following advantages:
- no more ISP-related trouble;
- possibility to split the mailing in smaller piece: to allow error recovery the generated script files contains regular comments with a mail counter, so by using common Unix tools like csplit we are able to restart a mailing from any point;
- when running the final bash script, the counter is echo-ed to stdout, so you always know what's happening;
- we easily added the support for a "<ruby>ruby script</ruby>" syntax into Maxbulk files, allowing more sophisticated scripting features to Maxbulk
(variables are named as your columns as with normal Maxbulk macro syntax…)
- since everything is done by scripts of our own, we have fine control of every steps and we could add any fancy features if we need to (as conditional attachments…)
Point to be careful with:
- encoding of the saved file (we choose to always work with UTF-8);
- binding between column numbers and human friendly names has to be defined in the script and any changes means modification of the script;
So the whole workflow is now:
- make the mailing design with Maxbulk as we have always done;
- import our test mailing list (a database of pseudo-customers with different characteristics) to check all the possibilities (to be sure the macros work on the server exactly as on the workstation…);
- save the MaxBulk file and drop it on a droplet of our own (an Automator script, the workstation is a Mac…) that connects to the server thru ssh , copy the file (and the attachments if any) in the drop folder and then starts the Ruby script on the server with the dropped file as argument…
- read the test mailboxes to check everything is ok;
- and eventually re-do the same with the actual customer database;
If anyone interested for more info, just drop me a private message…
The basic requirements to run this solution are:
- Unix server with ssh and bash shell access
- Ruby installed (the only "require" are "tmpfile" and "date")
- Unix mail command working |
|