小编Ena*_*lds的帖子

PHP Perl - mail/mime.php 无法打开流

我需要一些帮助,如何使用 Perl 发送电子邮件。

当我尝试运行此代码时:

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"] = 'sample@sampel.com';
$headers["To"] = "sample@sampel.com"; 
$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"; …
Run Code Online (Sandbox Code Playgroud)

php php-5.5

0
推荐指数
1
解决办法
3180
查看次数

标签 统计

php ×1

php-5.5 ×1