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 function correo ($arg1,$arg2,$arg3,$arg4) { require_once "Mail.php"; $from = $arg1; $to = $arg2; $subject = $arg3; $body = $arg4; $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)) { return $mail->getMessage(); } else { return "OK"; } } ?>
informatica/linux/php/mail.1194220174.txt.gz · Last modified: 2015/04/13 20:19 (external edit)