Foros del Web » Programando para Internet » PHP »

Problema con Envio de mail

Estas en el tema de Problema con Envio de mail en el foro de PHP en Foros del Web. Hola amigos, ya habia puesto un post con un tema parecido. El tema es que cuando, probando el famoso "forgot your password" en un formulario ...
  #1 (permalink)  
Antiguo 08/10/2008, 11:53
Avatar de gabyfornia  
Fecha de Ingreso: diciembre-2004
Ubicación: USA
Mensajes: 182
Antigüedad: 19 años, 4 meses
Puntos: 0
Exclamación Problema con Envio de mail

Hola amigos, ya habia puesto un post con un tema parecido. El tema es que cuando, probando el famoso "forgot your password" en un formulario de login, al incluir el email para el envio supuesto del password, me sale un mensaje asi:


Developer Details: E-mail couldn't be sent. Error returned: mail() returned failure

Warning: mail(): SMTP server response: 553 Sorry, that domain isn't in my list of allowed rcpthosts. in c:\appserv\www\uniendolatinos2009\includes\common\ lib\email\Pear\Mail\mail.php on line 115
. (EMAIL_FAILED)

Ahora bien, el tema es que si bien ya configure el php.ini con mi server del correo, igual me sale todo mal y quiero incluir la funcion ini_set en el siguiente codigo de php, probe de algunas formas pero no tuve exito, donde deberia ir inserto este codigo?: ini_set(sendmail_from,'[email protected]');


Código php:
Ver original
  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | [URL]http://www.php.net/license/2_02.txt[/URL].                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | [EMAIL="[email protected]"][email protected][/EMAIL] so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Author: Chuck Hagenbuch <[EMAIL="[email protected]"][email protected][/EMAIL]>                            |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: mail.php,v 1.14 2005/08/09 04:54:37 jon Exp $
  20. /**
  21.  * internal PHP-mail() implementation of the PEAR Mail:: interface.
  22.  * @package Mail
  23.  * @version $Revision: 1.14 $
  24.  */
  25. class Mail_mail extends Mail {
  26.     /**
  27.      * Any arguments to pass to the mail() function.
  28.      * @var string
  29.      */
  30.     var $_params = '';
  31.     /**
  32.      * Constructor.
  33.      *
  34.      * Instantiates a new Mail_mail:: object based on the parameters
  35.      * passed in.
  36.      *
  37.      * @param array $params Extra arguments for the mail() function.
  38.      */
  39.     function Mail_mail($params = null)
  40.     {
  41.         /* The other mail implementations accept parameters as arrays.
  42.          * In the interest of being consistent, explode an array into
  43.          * a string of parameter arguments. */
  44.         if (is_array($params)) {
  45.             $this->_params = join(' ', $params);
  46.         } else {
  47.             $this->_params = $params;
  48.         }
  49.         /* Because the mail() function may pass headers as command
  50.          * line arguments, we can't guarantee the use of the standard
  51.          * "\r\n" separator.  Instead, we use the system's native line
  52.          * separator. */
  53.         $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
  54.     }
  55.  /**
  56.      * Implements Mail_mail::send() function using php's built-in mail()
  57.      * command.
  58.      *
  59.      * @param mixed $recipients Either a comma-seperated list of recipients
  60.      *              (RFC822 compliant), or an array of recipients,
  61.      *              each RFC822 valid. This may contain recipients not
  62.      *              specified in the headers, for Bcc:, resending
  63.      *              messages, etc.
  64.      *
  65.      * @param array $headers The array of headers to send with the mail, in an
  66.      *              associative array, where the array key is the
  67.      *              header name (ie, 'Subject'), and the array value
  68.      *              is the header value (ie, 'test'). The header
  69.      *              produced from those values would be 'Subject:
  70.      *              test'.
  71.      *
  72.      * @param string $body The full text of the message body, including any
  73.      *               Mime parts, etc.
  74.      *
  75.      * @return mixed Returns true on success, or a PEAR_Error
  76.      *               containing a descriptive error message on
  77.      *               failure.
  78.      *
  79.      * @access public
  80.      */
  81.     function send($recipients, $headers, $body)
  82.     {
  83.         // If we're passed an array of recipients, implode it.
  84.         if (is_array($recipients)) {
  85.             $recipients = implode(', ', $recipients);
  86.         }
  87.         // Get the Subject out of the headers array so that we can
  88.         // pass it as a seperate argument to mail().
  89.         $subject = '';
  90.         if (isset($headers['Subject'])) {
  91.             $subject = $headers['Subject'];
  92.             unset($headers['Subject']);
  93.         }
  94.         // Flatten the headers out.
  95.         $headerElements = $this->prepareHeaders($headers);
  96.         if (PEAR::isError($headerElements)) {
  97.             return $headerElements;
  98.         }
  99.         list(, $text_headers) = $headerElements;
  100.         /*
  101.          * We only use mail()'s optional fifth parameter if the additional
  102.          * parameters have been provided and we're not running in safe mode.
  103.          */
  104.         $warnings = '';
  105.         ob_start();
  106.         if (empty($this->_params) || ini_get('safe_mode')) {
  107.             $result = mail($recipients, $subject, $body, $text_headers);
  108.         } else {
  109.             $result = mail($recipients, $subject, $body, $text_headers,
  110.                            $this->_params);
  111.         }
  112.         $warnings = ob_get_contents();
  113.         ob_end_clean();
  114.         /*
  115.          * If the mail() function returned failure, we need to create a
  116.          * PEAR_Error object and return it instead of the boolean result.
  117.          */
  118.         if ($result === false) {
  119.             $result = PEAR::raiseError('mail() returned failure<br />'.$warnings);
  120.         }
  121.         return $result;
  122.     }
  123. }
  124. ?>
__________________
:stress: De las Aves que Vuelan me gusta el Chancho!!:si:

Última edición por GatorV; 08/10/2008 a las 12:42 Razón: tags PHP
  #2 (permalink)  
Antiguo 08/10/2008, 12:43
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: Problema con Envio de mail

Hola gabyfornia,

El ini_set lo puedes poner en cualquier lado, el tema es que tu server SMTP no acepta conexiones al servidor que le estas tratando de enviar, por lo que no importa que cambies en el código PHP siempre te marcará el mismo error.

Debes de cambiar la configuración de tu servidor SMTP por la correcta para que te funcione tu programa.

Saludos.
  #3 (permalink)  
Antiguo 09/10/2008, 09:08
Avatar de gabyfornia  
Fecha de Ingreso: diciembre-2004
Ubicación: USA
Mensajes: 182
Antigüedad: 19 años, 4 meses
Puntos: 0
Exclamación Duda con ini_set

Amigos, quiero que alguien me diga donde va ubicado exactamente este fragmento de codigo dentro del php que coloco a continuacion, he probado de mil maneras y no hay caso, seguro que los que saben de php me lo podran decir:

el fragmento: ini_set(sendmail_from,'[email protected]);

el codigo php:

<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Chuck Hagenbuch <[email protected]> |
// +----------------------------------------------------------------------+
//
// $Id: mail.php,v 1.14 2005/08/09 04:54:37 jon Exp $
/**
* internal PHP-mail() implementation of the PEAR Mail:: interface.
* @package Mail
* @version $Revision: 1.14 $
*/
class Mail_mail extends Mail {
/**
* Any arguments to pass to the mail() function.
* @var string
*/
var $_params = '';
/**
* Constructor.
*
* Instantiates a new Mail_mail:: object based on the parameters
* passed in.
*
* @param array $params Extra arguments for the mail() function.
*/
function Mail_mail($params = null)
{
/* The other mail implementations accept parameters as arrays.
* In the interest of being consistent, explode an array into
* a string of parameter arguments. */
if (is_array($params)) {
$this->_params = join(' ', $params);
} else {
$this->_params = $params;
}
/* Because the mail() function may pass headers as command
* line arguments, we can't guarantee the use of the standard
* "\r\n" separator. Instead, we use the system's native line
* separator. */
$this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
}
/**
* Implements Mail_mail::send() function using php's built-in mail()
* command.
*
* @param mixed $recipients Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid. This may contain recipients not
* specified in the headers, for Bcc:, resending
* messages, etc.
*
* @param array $headers The array of headers to send with the mail, in an
* associative array, where the array key is the
* header name (ie, 'Subject'), and the array value
* is the header value (ie, 'test'). The header
* produced from those values would be 'Subject:
* test'.
*
* @param string $body The full text of the message body, including any
* Mime parts, etc.
*
* @return mixed Returns true on success, or a PEAR_Error
* containing a descriptive error message on
* failure.
*
* @access public
*/
function send($recipients, $headers, $body)
{
// If we're passed an array of recipients, implode it.
if (is_array($recipients)) {
$recipients = implode(', ', $recipients);
}
// Get the Subject out of the headers array so that we can
// pass it as a seperate argument to mail().
$subject = '';
if (isset($headers['Subject'])) {
$subject = $headers['Subject'];
unset($headers['Subject']);
}
// Flatten the headers out.
$headerElements = $this->prepareHeaders($headers);
if (PEAR::isError($headerElements)) {
return $headerElements;
}
list(, $text_headers) = $headerElements;
/*
* We only use mail()'s optional fifth parameter if the additional
* parameters have been provided and we're not running in safe mode.
*/
$warnings = '';
ob_start();
if (empty($this->_params) || ini_get('safe_mode')) || {
$result = mail($recipients, $subject, $body, $text_headers);
} else {
$result = mail($recipients, $subject, $body, $text_headers,
$this->_params);
}
$warnings = ob_get_contents();
ob_end_clean();
/*
* If the mail() function returned failure, we need to create a
* PEAR_Error object and return it instead of the boolean result.
*/
if ($result === false) {
$result = PEAR::raiseError('mail() returned failure<br />'.$warnings);
}
return $result;
}
}
?>
__________________
:stress: De las Aves que Vuelan me gusta el Chancho!!:si:
  #4 (permalink)  
Antiguo 09/10/2008, 09:12
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Duda con ini_set

antes de todo... al principio

suerte!
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #5 (permalink)  
Antiguo 09/10/2008, 09:18
Avatar de gabyfornia  
Fecha de Ingreso: diciembre-2004
Ubicación: USA
Mensajes: 182
Antigüedad: 19 años, 4 meses
Puntos: 0
Respuesta: Duda con ini_set

Asi lo hice pero me sale el siguiente error:

Parse error: syntax error, unexpected T_BOOLEAN_OR in c:\appserv\www\uniendolatinos2009\includes\common\ lib\email\Pear\Mail\mail.php on line 116
__________________
:stress: De las Aves que Vuelan me gusta el Chancho!!:si:
  #6 (permalink)  
Antiguo 09/10/2008, 09:49
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: Duda con ini_set

Temas unidos por favor no dupliques temas.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:12.