我的代码:
<?php
date_default_timezone_set("Asia/Phnom_Penh");
$envelop['date'] = date("F j, Y, h:i");
$envelop['from'] = "freehost0827@gmail.com";
$envelop['to'] = "example@gmail.com";
$envelop['subject'] = "Testing";
$p['type'] = TYPETEXT;
$p['encoding'] = ENCBASE64;
$p['subtype'] = "plain";
$p['description'] = "Learning to create mime";
$p['contents.data'] = "Some text";
$body[1] = $p;
print_r(imap_mail_compose($envelop, $body));
?>
执行:
$ php mime.php
Warning: Use of undefined constant TYPETEXT - assumed 'TYPETEXT' (this will th
row an Error in a future version of PHP) in /data/data/com.termux/files/home/g
mail_api/test/mime.php on line 8
Warning: Use of undefined constant ENCBASE64 - assumed 'ENCBASE64' (this will
throw an Error in a future version of PHP) in /data/data/com.termux/files/home
/gmail_api/test/mime.php on line 9
Fatal error: Uncaught Error: Call to undefined function imap_mail_compose() in
/data/data/com.termux/files/home/gmail_api/test/mime.php:15
Stack trace:
#0 {main}
thrown in /data/data/com.termux/files/home/gmail_api/test/mime.php on line 1
5
我正在尝试使用 PHP 编写 mime 消息,imap_mail_compose()
但它抱怨未定义的函数。我怎样才能解决这个问题?