Category Archives: Server Hosting Constraints

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;

 

Go Daddy Shared Hosting – They Do It Their Way…

During my drive home from work tonight I thought I might try to see if I could get some simple JSON REST services running on on my Go Daddy Shared Hosting Account.  I’ve never used Sinatra before and wanted to see if I could build something useful with it and have it running on the internet…for realz.  Unfortunately, Go Daddy appears to have discontinued all Ruby Support as of January 2014.  The curious thing, however, is that I have ruby on the command line on my server, and could even install Sinatra (‘gem install sinatra’), but I cannot get the simplest ruby script to run as a CGI script without getting a 500 Server Error.

Conclusion?  I will stick with Perl scripting (currently Go Daddy supports Perl, PHP and Python) for now since I am too cheap to upgrade to a Virtual Private Server (VPS) just for this reason.  However, If I build something substantial and/or mildly popular at some point in my life, I would like to maybe use Sinatra based web services in support of my application.  But by then, I may be using a different hosting service provider so I can do things MY way.