我需要一些帮助如何使用Perl发送电子邮件。PHP Perl - 邮件/ mime.php未能打开流
当我尝试运行此代码:
require_once ("Mail.php");
require_once ("Mail/mime.php");
$text = "test";
$html_message = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>....</title>
</head>
<body>
<p>...</p>
</body>
</html>';
$headers["From"] = '[email protected]';
$headers["To"] = "[email protected]";
$headers["Subject"] = "Sample SMTP PERL";
$headers["Content-Type"] = 'text/html; charset=UTF-8';
$headers["Content-Transfer-Encoding"]= "8bit";
$mime = new Mail_mime;
$mime->setTXTBody($text);
$mime->setHTMLBody($html_message);
$mimeparams=array();
// It refused to change to UTF-8 even if the header was set to this, after adding the following lines it worked.
$mimeparams['text_encoding']="8bit";
$mimeparams['text_charset']="UTF-8";
$mimeparams['html_charset']="UTF-8";
$mimeparams['head_charset']="UTF-8";
$mimeparams["debug"] = "True";
$body = $mime->get($mimeparams);
$headers = $mime->headers($headers);
$page_content = "Mail now.";
// SMTP server name, port, user/passwd
$smtpinfo["host"] = "xxx;
$smtpinfo["port"] = "465";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "[email protected]";
$smtpinfo["password"] = "xxx";
$smtpinfo["debug"] = "True";
// Create the mail object using the Mail::factory method
$mail=& Mail::factory("smtp", $smtpinfo);
$mail->send($to, $headers, $body));
我得到这个错误信息:
PHP Warning: require_once(Mail/mime.php): failed to open stream: No
such file or directory in /home3/xxx/public_html/xxx/zzz/ccc/vvv.php
on line 203
PHP Fatal error: require_once(): Failed opening required
'Mail/mime.php'
(include_path='.:/usr/php/54/usr/lib64:/usr/php/54/usr/share/pear:/usr/lib/php/PEAR')
in /home3/xxx/public_html/xxx/zzz/ccc/vvv.php on line 203
而且我不知道如何解决。请帮忙。