informatica:linux:php:mail
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
informatica:linux:php:mail [2007/11/04 23:18] – 192.168.1.12 | informatica:linux:php:mail [2015/04/13 20:19] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
Instalamos paquetes necesarios de PEAR. Yo he instalado: php-mail, php5-dev, php-net-mail, | Instalamos paquetes necesarios de PEAR. Yo he instalado: php-mail, php5-dev, php-net-mail, | ||
+ | He creado la funcion / | ||
+ | Devuelve OK o el error si no se envía: | ||
- | <? | + | <?php |
+ | function correo ($arg1, | ||
+ | { | ||
require_once " | require_once " | ||
- | + | | |
- | $from = "Ose < | + | $from = $arg1; |
- | $to = "Jose < | + | $to = $arg2; |
- | $subject = " | + | $subject = $arg3; |
- | $body = " | + | $body = $arg4; |
- | + | ||
- | $host = " | + | $host = " |
- | $username = " | + | $username = " |
$password = " | $password = " | ||
- | + | | |
- | $headers = array (' | + | $headers = array (' |
- | ' | + | ' |
- | ' | + | ' |
- | $smtp = Mail:: | + | $smtp = Mail:: |
- | array (' | + | array (' |
- | ' | + | ' |
- | ' | + | ' |
' | ' | ||
- | + | | |
- | $mail = $smtp-> | + | $mail = $smtp-> |
- | if (PEAR:: | + | if (PEAR:: |
- | | + | |
- | } else { \\ | + | |
- | | + | } |
- | } \\ | + | |
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
?> | ?> | ||
+ | Para enviar un correo. El echo es para que devuelva la salida OK o el error:\\ | ||
+ | <? | ||
+ | include correo; | ||
+ | echo correo ("Jose < | ||
+ | echo correo (" | ||
+ | ?> | ||
informatica/linux/php/mail.1194218316.txt.gz · Last modified: 2015/04/13 20:19 (external edit)