note 39305 added to ref.mail

From: Date: Fri, 23 Jan 2004 21:16:11 +0000
Subject: note 39305 added to ref.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-64083@lists.php.net to get a copy of this message
If you can't use or don't understand how to use the sendmail program from linux, you can use a PEAR object to send mail. <? include("Mail.php"); $recipients = "mail_to@domain.mail"; $headers["From"] = "mail_from@domain.mail"; $headers["To"] = "mail_to@domain.mail"; $headers["Subject"] = "Test message"; $body = "TEST MESSAGE!!!"; $params["host"] = "smtp.server"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "user"; $params["password"] = "password"; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory("smtp", $params); $mail_object->send($recipients, $headers, $body); ?> In my case, i use a smtp server that require authentication, and sendmail configuration is almost cryptic to me. PEAR is already installed in PHP 4.0.3 , if not, you must go to pear.php.net and install it, in my case, I needed to add the Socket.php to the PEAR library. ---- Manual Page -- http://www.php.net/manual/en/ref.mail.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39305 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39305&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39305&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64083) next »