Posts

Showing posts from July, 2008

Send email by using PHP

if your ISP need SMTP Authentication then you need Pear installed for you php5, and also add one line in your php.ini file: extension=php_gd2.dll require_once "Mail.php"; $from = "Sandra Sender "; $to = "Ramona Recipient "; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "househosting.ca"; $username = "smtp_username"; $password = "smtp_password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo(" " . $mail->getMessage() . " "); } else { echo(" Message successfully sent! "); } ?>