How do I send email with Perl or PHP?
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.
Create & Update Tab: PHP/Perl Mail Link
The mail setup process allows you to customize the email address that users will see when you send them a message (for example, "From: firstname.lastname@example.org").
You will also need to indicate the path to the Yahoo mail program, Sendmail, in the Perl or PHP script. 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.
print "Content-type: text/html\n\n";
$to='MAIL ADDRESS TO SEND TO';
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";
## START HTML content
A message has been sent from $from to $to";
## END HTML CONTENT
Thank you! Your feedback has successfully been submitted.
Please tell us why you didn't find this helpful.