Errores en mi codigo

Hola!
Estoy intentando enviar un boletin a mis usuarios registrados, el codigo para el envio te lo pongo al final, pero cuando lo intento enviar me salen errores referidos a la parte del codigo siguiente:
// include PEAR mail classes
include('Mail.php');
include('Mail/mime.php');
los errores que me dan son:
Warning: send(Mail/mime.php): failed to open stream: No such file or directory
Warning: send(): Failed opening 'Mail/mime.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php')
Cannot instantiate non-existent class: mail_mime
Codigo :
<?php
// do we already have a record of this subscriber?
function subscriber_exists($email)
{
if(!$email)
return false;
if(!db_connect())
return false;
$query = "select count(*) from subscribers where email = '$email'";
$result = mysql_query($query);
if(!$result)
return false;
return (mysql_result($result, 0, 0)>0);
}
// is this email address subscribed to this list?
function subscribed($email, $listid)
{
if(!$email||!$listid)
return false;
if(!db_connect())
return false;
$query = "select count(*) from sub_lists where email = '$email'
and listid = $listid";
$result = mysql_query($query);
if(!$result)
return false;
return (mysql_result($result, 0, 0)>0);
}
// is this listid the id of a list?
function list_exists($listid)
{
if(!$listid)
return false;
if(!db_connect())
return false;
$query = "select count(*) from lists where listid = '$listid'";
$result = mysql_query($query);
if(!$result)
return false;
return (mysql_result($result, 0, 0)>0);
}
// get the name of the person with this email
function get_real_name($email)
{
if(!$email)
return false;
if(!db_connect())
return false;
$query = "select realname from subscribers where email = '$email'";
$result = mysql_query($query);
if(!$result)
return false;
return trim(mysql_result($result, 0, 0));
}
// get the type (HTML or Text) that this person wants email in
function get_mimetype($email)
{
if(!$email)
return false;
if(!db_connect())
return false;
$query = "select mimetype from subscribers where email = '$email'";
$result = mysql_query($query);
if(!$result)
return false;
return trim(mysql_result($result, 0, 0));
}
// subscribe this email address to this list
function subscribe($email, $listid)
{
if(!$email||!$listid||!list_exists($listid)||!subscriber_exists($email))
return false;
//if already subscribed exit
if(subscribed($email, $listid))
return false;
if(!db_connect())
return false;
$query = "insert into sub_lists values ('$email', $listid)";
$result = mysql_query($query);
return $result;
}
// unsubscribe this email address from this list
function unsubscribe($email, $listid)
{
if(!$email||!$listid)
return false;
if(!db_connect())
return false;
$query = "delete from sub_lists where email = '$email' and listid = $listid";
$result = mysql_query($query);
return $result;
}
// load the data stored about this mail from the database
function load_mail_info($mailid)
{
if(!$mailid)
return false;
if(!db_connect())
return false;
$query = "select subject, listid, status, sent from mail
where mailid = $mailid";
$result = mysql_query($query);
if(!$result)
{
echo "Cannot retrieve this mail $query";
return false;
}
return mysql_fetch_array($result);
}
// load the data stored about this list from the database
function load_list_info($listid)
{
if(!$listid)
return false;
if(!db_connect())
return false;
$query = "select listname, blurb from lists where listid = $listid";
$result = mysql_query($query);
if(!$result)
{
echo 'Cannot retrieve this list';
return false;
}
$info = mysql_fetch_array($result);
$query = "select count(*) from sub_lists where listid = $listid";
$result = mysql_query($query);
if($result)
{
$info['subscribers'] = mysql_result($result, 0, 0);
}
$query = "select count(*) from mail where listid = $listid
and status = 'SENT'";
$result = mysql_query($query);
if($result)
{
$info['archive'] = mysql_result($result, 0, 0);
}
return $info;
}
// get the name that belongs to this list id
function get_list_name($listid)
{
if(!$listid)
return false;
if(!db_connect())
return false;
$query = "select listname from lists where listid = $listid";
$result = mysql_query($query);
if(!$result)
{
return false;
}
return mysql_result($result, 0);
}
// add a new list to the database
function store_list($admin_user, $details)
{
if(!filled_out($details))
{
echo 'All fields must be filled in. Try again.<br /><br />';
return false;
}
else
{
if(!check_admin_user($admin_user))
return false;
// how did this function get called by somebody not logged in as admin?
if(!db_connect())
{
return false;
}
$query = "select count(*) from lists where listname = '".$details['name']."'";
$result = mysql_query($query);
if(mysql_result($result, 0, 0) > 0)
{
echo 'Sorry, there is already a list with this name.';
return false;
}
$query = "insert into lists values (NULL,
'".$details['name']."',
'".$details['blurb']."')";
$result = mysql_query($query);
return $result;
}
}
// get the lists that this user is subscribed to
function get_subscribed_lists($email)
{
$list = array();
$query = "select lists.listid, listname from sub_lists, lists
where email='$email' and lists.listid = sub_lists.listid
order by listname";
if(db_connect())
{
$result = mysql_query($query);
if(!$result)
echo '<p>Unable to get list from database.';
$num = mysql_numrows($result);
for($i = 0; $i<$num; $i++)
{
array_push($list, array(mysql_result($result, $i, 0),
mysql_result($result, $i, 1)));
}
}
return $list;
}
//get the lists that this user is *not* subscribed to
function get_unsubscribed_lists($email)
{
$list = array();
$query = "select lists.listid, listname, email from lists left join sub_lists
on lists.listid = sub_lists.listid
and email='$email' where email is NULL order by listname";
if(db_connect())
{
$result = mysql_query($query);
if(!$result)
echo...
Respuesta
1
Así a bote pronto, sin mirar demasiado el código, parece un problema de rutas. Comrpueba:
Que existan las rutas que pones en:
include('Mail.php');
include('Mail/mime.php');
¿Es en mayúsculas? ¿Minusculas? Revisa tu php.ini

3 respuestas más de otros expertos

Respuesta
1
Eso te esta indicando que no dispones de los archivos Mail.php ni mime.php o no estan en el lugar donde php los busca. Concretamente, deben estar bajo /usr/lib/php o /usr/local/lib/php. O sea que debes buscar /usr/lib/php/Mail.php, /usr/lib/php/Mail/mime.php,
/usr/local/lib/php/Mail.php o
/usr/local/lib/php/Mail/mime.php
O trasladarlos debajo de alguno de esos dos directorios.
Respuesta
1
---------------------------------
Warning: send(Mail/mime.php): failed to open stream: No such file or directory
Warning: send(): Failed opening 'Mail/mime.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php')
Cannot instantiate non-existent class: mail_mime
---------------------------------
Ahi lo que te está diciendo es que en alguna parte de tu script estás haciendo un include o un require a un fichero que a lo mejor existe pero no lo estás referenciando bien. Revisa los includes y/o require que tengas en tu script que los mismos esten apuntando al directorio donde tienes esos scripts.
Salu2
Respuesta
1
Por lo que veo en el error que me contás parece que estás
Especificando mal el path del
include("Mail/mime.php");
No está encontrando ese directorio...
Revisá bien esa parte y despues vemos...

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas