Before you can send email with Perl or PHP, you must complete the PHP/Perl Mail Setup process. To begin setting up PHP/Perl mail, click the "PHP/Perl Mail" link on the Create & Update or Index tabs of your Web Hosting Control Panel. The mail setup process allows you to customize the email address that users will see when you send them a message (for example, "From: siteowner@widgetdesigns.com").
You will also need to indicate the path to the Yahoo! mail program, Sendmail. The path to Sendmail is /usr/sbin/sendmail.
Please note that you will be limited to 250 emails per day to recipients outside your domain. The "From:" address used in your script must also contain your domain name. If the "From:" field is omitted, your default account email address will be used.
Below is a sample Perl script you can use to send email. You will need to specify the "to" and "from" address.
Note: Notice that the subject line in the sample script below ends with two \n characters. These characters are required to separate the email header from the email body with a blank line. If you are not seeing the body of your email, be sure to double-check that these characters are present.
#!/usr/bin/perl
print "Content-type: text/html\n\n";
$title='mail test';
$to='MAIL ADDRESS TO SEND TO';
$from= 'EMAIL@YOURDOMAIN.COM';
$subject='Using Sendmail';open(MAIL, "|/usr/sbin/sendmail -t");
## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
print MAIL "This is a test message from Yahoo! \n";close(MAIL);
print "<html><head><title>$title<
/title></head>\n<body>\n\n";## START HTML content
print "<h1>$title</h1>\n";
print "<p>A message has been sent from $from to $to";
## END HTML CONTENT
print "\n\n</body></html>";
To learn more about Perl, visit the Perl.com web site, purchase a book about Perl, or review other Perl resources.
To learn more about how to send email with PHP, we suggest researching the PHP Group web site or getting a book on PHP. It may also be helpful to review other PHP resources.