informatica:linux:php:mail
This is an old revision of the document!
Instalamos paquetes necesarios de PEAR. Yo he instalado: php-mail, php5-dev, php-net-mail, php-net-smtp.
<?php
require_once "Mail.php";
$from = "Ose <lobo99@lobo99.info>";
$to = "Jose <jlegido@mailext.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "smtp.jazztel.es";
$username = "lobo99.lobo99.jazztel.es";
$password = "lobo99";
$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("<p>" . $mail->getMessage() . "</p>");
}
else
{
echo("<p>Message successfully sent!</p>");
}
?>
informatica/linux/php/mail.1194218484.txt.gz · Last modified: (external edit)
