Category Archives: website

Simple Email Notifications With Perl

I’m working on an application that needs to send email notifications using a Perl-based back end.  In my spare time, I’m developing a scheduling platform for yard service/lawn care applications.  In prototyping solutions on a Godaddy shared hosting server, my ability to install Perl packages in the hosted environment is very limited, so I am forced to work with what is available to me.  For sending email, the available Perl packages include Net::SMTP.  Luckily, using Net::SMTP to send email is easy and straight-forward, however I had some difficulty figuring out how to correctly send the Subject part of an email, primarily because most of the documentation on the web is not correct.  Net::SMTP is a relatively low level package, so all you need to understand for the correct usage of this package is how to send email by hand.  Here’s a good tutorial for using telnet on port 25 of a known SMTP Server to manually craft an email.

Here’s how to send an email with Perl, using Net::SMTP, which contains a proper Email Subject:

#!/usr/bin/perl
use strict;
use warnings;

use Net::SMTP;

my $smtp = Net::SMTP->new("localhost", Hello => 'mydomain.com', Timeout => 30, Debug => 1);
$smtp->mail("no-reply\@mydomain.com"); 
$smtp->to("service-request\@mydomain.com");
$smtp->data();
$smtp->datasend("Subject: Email Test");
$smtp->datasend("\r\n\r\n");
$smtp->datasend("Hallo Welt!");
$smtp->dataend;
$smtp->quit;

 

'Out of the Box' Rubik

Building An Email List

I’m working on a website right now for my Ocean Rowing Expedition next year (http://www.1000leagues.com), and to help keep in touch with interested people, we are building an email list (click the ‘Join Our Team’ link).  Initially, my plan was to simply create a Google Contact Group, add emails to the Google Contact, and email the list our updates by putting the Contacts in the BCC field of our email communications.  This strategy did not last very long as Google Gmail starting blocking our outbound email and treating them as span.  So at around 50 email addresses on our list, we had to migrate to a new platform.

I chose to use MailChimp as the next platform for maintaining and emailing our list.  So far, I am really impressed with MailChimp.  For a list our size, and the frequency we send communications out (about once a week for around 62 members), this platform is free and delivers a disproportionate amount of value for the cost.

MailChimp offers really cool reports on how many people have received your email, how many have opened the email, which URLs contained in your email were clicked, etc.  Moreover, the email templates MailChimp gives you for creating your email campaigns are really nice looking and easy to set up.  So far, I am really impressed with MailChimp.

This week I listened to a Pat Flynn Podcast, at Smart Passive Income, where he interviews Bryan Harris, who really offers quite a bit of additional help in how to build an email list.