php - smtp pear Mail.php 包括

发布于 2024-11-18 17:50:56 字数 660 浏览 1 评论 0原文

这可能是一个简单的问题,但我现在很困惑。我基本上使用了为之前的项目构建的相同框架并更改了皮肤。

我尝试测试电子邮件功能但失败,错误如下:

警告:require_once() [function.require-once]: open_basedir 限制生效。 文件(../../../../php/Mail.php)不是 在允许的路径内: (/home/amatoita:/usr/lib/php:/usr/local/lib/php:/tmp)

由于某种原因,我似乎不允许在这里???

所以我尝试了

/usr/lib/php/Mail.php

/home/amatoita/php/Mail.php

/usr/local/lib/php/Mail.php

引发以下错误:

需要打开失败 '邮件/mimePart.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') 在 /home/amatoita/php/Mail/mime.php

有人能看到我哪里出错了吗?

this may be a simple one but im confused now. I basicly using the same frame work which i built for a previouse project and changing the skin.

I have tried to test the email function but has failed to work, this is the error:

Warning: require_once()
[function.require-once]: open_basedir
restriction in effect.
File(../../../../php/Mail.php) is not
within the allowed path(s):
(/home/amatoita:/usr/lib/php:/usr/local/lib/php:/tmp)

for some reason It seems like im not allowed here???

so i tried

/usr/lib/php/Mail.php

/home/amatoita/php/Mail.php

/usr/local/lib/php/Mail.php

which threw the following error:

Failed opening required
'Mail/mimePart.php'
(include_path='.:/usr/lib/php:/usr/local/lib/php')
in /home/amatoita/php/Mail/mime.php

can anyone see where i am going wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一袭白衣梦中忆 2024-11-25 17:50:56

我能够按照 马克的技术博客

我的问题是 pear 的 Mail 模块未包含在标准 Fedora 安装中。

然后我使用了一些代码来自 PEAR 站点

<?php

include 'Mail.php';
include 'Mail/mime.php' ;

$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = '/home/richard/example.php';
$crlf = "\n";
$hdrs = array(
          'From'    => '[email protected]',
          'Subject' => 'Test mime message'
          );

$mime = new Mail_mime(array('eol' => $crlf));

$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'text/plain');

$body = $mime->get();
$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory('mail');
$mail->send('postmaster@localhost', $hdrs, $body);

?>

现在我的电子邮件可以很好地以 HTML 格式发送。希望对您有帮助。

I was able to fix this issue by following the PEAR install directions at Mark's Tech Stuff blog.

My problem was that the Mail module of pear is not included in a standard Fedora install.

Then I used some code from the PEAR site.

<?php

include 'Mail.php';
include 'Mail/mime.php' ;

$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = '/home/richard/example.php';
$crlf = "\n";
$hdrs = array(
          'From'    => '[email protected]',
          'Subject' => 'Test mime message'
          );

$mime = new Mail_mime(array('eol' => $crlf));

$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'text/plain');

$body = $mime->get();
$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory('mail');
$mail->send('postmaster@localhost', $hdrs, $body);

?>

Now my email gets sent in HTML just fine. Hope that helps you.

绾颜 2024-11-25 17:50:56

您需要将该软件包安装在 include_path 中列出的目录之一中。这意味着(最有可能),您希望它是:

/home/amatoita/php/Mail.php

并且将 mimePart.php 放在

/home/amatoita/php/Mail/mimepart.php

You'd need to have that package installed in one of the directories listed in the include_path. That means (most likely), you'd want it to be:

/home/amatoita/php/Mail.php

and have the mimePart.php in

/home/amatoita/php/Mail/mimepart.php
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文