PHP Tutorial
How do I use Sendmail using PHP?
Sendmail can be invoked by any PHP script. As in PERL or BASH, Sendmail can be
called by using a simple locator variable, or path to Sendmail in a specific
manner. There must also be a certain line inside of the Apache web server's
configuration file (httpd.conf) to ensure that the web server understands the
PHP Sendmail call. The line inside the httpd.conf file should look like this:
br> ADDTYPE php3_sendmail_path "/bin/sendmail -t"
The format of the PHP script to send email is as follows:
1)The mail function must be called (just like the echo function is) at the
beginning of the line by just typing mail.
2)Next, there must be a space, followed by the email address that the email
should be sent to should be next, then the subject line, then the body, then the
"From" address each inside of their own set of double quotes, separated by
commas.
Here's a simple example of how Sendmail can be called using a PHP script:
<?
#!/usr/local/bin/php
mail ("user@domain.net", "Check this out", "This is the body of the email, and
it works", "From: domain@domain.com\n");
?>