Description: Talking to the mail program is like writing to a file. (Perl programmers will be familiar with this technique). Instead of opening a file, the (popen() function specifies a program to pipe (communicate in a standard Unix way) your message to. This makes a connection to the mail program. The puts() function is used to "print" the message headers and message body out to the mail program, connected through the file descriptor already opened with the popen() function. Because you may want to use a different mail program than sendmail, it's a good idea to store this path in variable. You can store the recipient address in a variable to make it easy to change. Here is a simple script to send a message by talking directly to the sendmail program.
Language: PHP Highlight Mode: PHP Last Modified: March 16th, 2009
<?PHP$fd=POPEN("/usr/sbin/sendmail -t","w");FPUTS($fd,"To: firstname.lastname@example.org ");FPUTS($fd,"From: Me ");FPUTS($fd,"Subject: Test message from my web site ");FPUTS($fd,"X-Mailer: PHP3 ");FPUTS($fd,"Testing. ");PCLOSE($fd);?>
SQL University.net courses meet the most demanding needs of the business world for advanced education
in a cost-effective manner. SQL University.net courses are available immediately for IT professionals
and can be taken without disruption of your workplace schedule or processes.
Compared to traditional travel-based training, SQL University.net saves time and valuable corporate
resources, allowing companies to do more with less. That's our mission, and that's what we deliver.