All PHP coders are aware of the mail() function in PHP, which can be used to send mails. On Linux systems we ussually have Sendmail program installed, if someone is facing a problem sending mails with mail() function, they can alternatively use Sendmail to send mails.
For sending mails using Sendmail we need to open a pipe to the sendmail program, which can be accomplished using the popen() function in php.
Example:
For sending mails using Sendmail we need to open a pipe to the sendmail program, which can be accomplished using the popen() function in php.
Example:
PHP Code:
$fd = popen("/usr/sbin/sendmail -t","w") or die("Couldn't Open Sendmail");
fputs($fd, "To: recipient@hisdomain.com \n");
fputs($fd, "From: \"Your Name\" <youremail@yourdomain.com> \n");
fputs($fd, "Subject: Test message from my web site \n");
fputs($fd, "X-Mailer: PHP3 \n\n");
fputs($fd, "Testing. \n");
pclose($fd);


)