PEAR Handbuch | ||
---|---|---|
Zurück | Nach vorne |
Mail supports different types of backends to send email. So two steps are necessary to send an email.
Step 1
Create a new instance of a specific Mail -Backend with the factory()-method.
Step 2
Send the mail using send().
Mail supports three types of backends:
Sends a mail using PHPs build-in mail()-function.
sendmail
Sends a mail using a sendmail program.
smtp
Sends a mail directly connecting to a smtp server.
string $backend - the name of the backend "mail","smtp", "sendmail"
array $param - a array of backend specific parameters. See the Notes for possible values. This parameter is marked as optional, but at the moment every implemention requires this parameter.
List of parameter for the backends
no additional options
sendmail
$param["sendmail_path"] - The location of the sendmail program on the filesystem. Default is /usr/bin/sendmail
$param["sendmail_args"] - Additional parameters to pass to the sendmail program.
smtp
$param["host"] - The server to connect. Default is localhost
$param["port"] - The port to connect. Default is 25
$param["auth"] - Whether or not to use SMTP authentication. Default is false
$param["username"] - The username to use for SMTP authentication.
$param["password"] - The password to use for SMTP authentication.
<?php include('Mail.php'); $recipients = 'joe@example.com'; $headers['From'] = 'richard@phpguru.org'; $headers['To'] = 'joe@example.com'; $headers['Subject'] = 'Test message'; $body = 'Test message'; $params['sendmail_path'] = '/usr/lib/sendmail'; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('sendmail', $params); $mail_object->send($recipients, $headers, $body); ?> |
Zurück | Zum Anfang | Nach vorne |
Introduction | Nach oben | Mail_mime |