PHP Mail
I wanted to implement SMTP mail sending with authentication for some applications. For that I have installed pear/Mail on my server, its documentation is here. Using that I have written the following hard-coded function to assist me. I have used this in pmwiki and textpattern.
<?php ini_set("include_path", '/home/ekvastra/php:' . ini_get("include_path") ); require_once "Mail.php"; function ShortCircuit($from, $to, $subject, $body) { /* $from = "Web Master <webmaster@example.com>"; $to = "Nobody <nobody@example.com>"; $subject = "Test email using PHP SMTP with SSL\r\n\r\n"; $body = "This is a test email message"; */ $host = "ssl://server10.hostingraja.org"; $port = "465"; $username = "do-not-reply@ekvastra.in"; $password = "**** (really long auto generated nonsense password) "; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); /* if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } */ } ?>