How do I send e-mail from a Perl/CGI program on a Unix system?
Submitted by: AdministratorSending e-mail from a Perl/CGI program on a Unix computer system is usually pretty simple. Most Perl programs directly invoke the Unix sendmail program. We'll go through a quick example here.
Assuming that you've already have e-mail information you need, such as the send-to address and subject, you can use these next steps to generate and send the e-mail message:
# the rest of your program is up here ...
open(MAIL, "|/usr/lib/sendmail -t");
print MAIL "To: $sendToAddressn";
print MAIL "From: $myEmailAddressn";
print MAIL "Subject: $subjectn";
print MAIL "This is the message body.n";
print MAIL "Put your message here in the body.n";
close (MAIL);
Submitted by: Administrator
Assuming that you've already have e-mail information you need, such as the send-to address and subject, you can use these next steps to generate and send the e-mail message:
# the rest of your program is up here ...
open(MAIL, "|/usr/lib/sendmail -t");
print MAIL "To: $sendToAddressn";
print MAIL "From: $myEmailAddressn";
print MAIL "Subject: $subjectn";
print MAIL "This is the message body.n";
print MAIL "Put your message here in the body.n";
close (MAIL);
Submitted by: Administrator
Read Online Perl Programming Job Interview Questions And Answers
Top Perl Programming Questions
☺ | How do you give functions private variables that retain their values between calls? |
☺ | How many ways can we express string in Perl? |
☺ | How do you match one letter in the current locale? |
☺ | How do I set environment variables in Perl programs? |
☺ | How to open and read data files with Perl |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |