≡ Menu

apache web

How To Back Up a Web Server

Q. I'm using Red Hat Enterprise Linux based Apache web server. How do I backup my Apache webserver, MySQL and PostgreSQL database to another disk called /backup and then copy it to other offsite backup ssh server called backup.example.com?
[click to continue…]

Bash Shell Loop Over Set of Files

How do I run shell loop over set of files stored in a current directory or specified directory?
[click to continue…]

How do I send html email from Perl?

Q. How Can I send html email from cgi perl program under UNIX / Linux and Apache web sever?

A. Sending HTML email is an easy task with MIME::Lite CPAN module. It is a low-calorie MIME generator.

It can be use to send html emails, graphics file email attachments as a single-part or multi-part message. Here is simple perl script that sends html email.

Install Perl MIME::Lite

If you do not have MIME::Lite module, install using following command (login as a root user):

# cpan -i MIME::Lite

Perl script code

Script to send html email from perl:

#!/usr/bin/perl -w use strict; use MIME::Lite; # SendTo email id my $email = 'user@somewhere.com'; # create a new MIME Lite based email my $msg = MIME::Lite->new ( Subject => "HTML email test", From => 'YOU@somewhere.com', To => $email, Type => 'text/html', Data => '<H1>Hello</H1><br>This is a test email. Please visit our site <a href="http://cyberciti.biz/">online</a><hr>' ); $msg->send();

Save the script and execute it. Here is an email (sample) send by above script:

Read man page of MIME::Lite for more information:

perldoc MIME::Lite