dstd2129 2015-01-15 11:21
浏览 180

PHP警告:require(Mail.php):无法打开流:/ home /中没有这样的文件或目录

I am using Mochahost , I have have installed Mail from Pear. Now i don't know where it has installed the the files.

Kindly guide me where it has stored the installed files.

When i am using the following code its giving me the following error message.

      PHP Warning:  require(Mail.php): failed to open stream: 
No such file or directory in /home/

The error message is obvious, as i haven't added any file in my application folder.

The following is the code i am following.

Kindly guide me how to include the path of'Mail.php' file .

<?php

//require_once "Mail.php";
require "Mail.php";



$from = "Taha <abc@Hotmail.com>";


$to = "Taha <abc@Hotmail.com>";

$subject = "Hi!";

$body = "Hi,

How are you?";



$host = "111.11.11.111";

$username = "abc@Hotmail.com";

$password = "password";



$headers = array ('From' => $from,


  'To' => $to,

  'Subject' => $subject);



 $port = "2525";

 $smtp = Mail::factory('smtp',

  array ('host' => $host,

    'port' => $port,

    'auth' => true,

    'username' => $username,


    'password' => $password)); 

$mail = $smtp->send($to, $headers, $body);

echo "PEAR before";

if (PEAR::isError($mail)) {

  echo("<p>" . $mail->getMessage() . "</p>");


 } else {

  echo("<p>Message successfully sent!</p>");

 }
  • 写回答

3条回答 默认 最新

  • doute3621 2015-01-15 11:32
    关注

    Check if you have the pear directory in the include_path

    php -r "echo get_include_path();"
    

    if not you have to include it on your php.ini, or adding it directly on your code

    <?php 
    $path = '/usr/lib/pear';
    set_include_path(get_include_path() . PATH_SEPARATOR . $path);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 我这模型写的不对吗?为什么lingo解出来的下面影子价格这一溜少一个变量
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波