如何在网上找到图像并通过彩信邮寄为图像。
我试过Mail MIME,但我得到了这个错误:
[2015年8月23日19:39:06 America / Detroit] PHP致命错误:无法在第83行的/home/whatevertesting/public_html/test/mimePart.php中重新声明类Mail_mimePart
我基本上看看这个网站是如何做到的:http://www.textport.com/send_picture.aspx
将图像发送到手机。
我尝试了什么:
我去了https://pear.php.net/package/Mail_Mime/
并下载了1.9.0 stable release。其中包括
tests/test_Bug_20xxx.php
... (test bug goes on for a bit)
scripts/phail.php
Mail/mime.php
Mail/mimePart.php
然后我转到示例https://pear.php.net/manual/en/package.mail.mail-mime.example.php并尝试了所包含的内容......示例未提供mail.php
,因此我的代码是:
<?php
echo "Sending MMS...";
error_reporting(E_ALL);
include 'mime.php';
include 'mimePart.php';
$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = 'hello.txt';
$crlf = "\n";
$hdrs = array(
'From' => 'myemail@email.net',
'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('myemail@gmail.com', $hdrs, $body);
?>
更改了电子邮件...但是你知道了。 hello.txt
也位于同一目录中,我将mime.php
和mimePart.php
移至与上述代码相同的目录。
错误:[23-Aug-2015 19:39:06 America/Detroit] PHP Fatal error: Cannot redeclare class Mail_mimePart in /home/whatevertesting/public_html/test/mimePart.php on line 83
发生了。
删除include 'mimePart.php';
给了我这个:
[23-Aug-2015 21:31:18 America/Detroit] PHP Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in /home/test_user/public_html/example/mime.php on line 1333
[23-Aug-2015 21:31:18 America/Detroit] PHP Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in /home/test_user/public_html/example/mime.php on line 1333
[23-Aug-2015 21:31:18 America/Detroit] PHP Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in /home/test_user/public_html/example/mime.php on line 1333
[23-Aug-2015 21:31:18 America/Detroit] PHP Strict Standards: Non-static method Mail_mimePart::_explodeQuotedString() should not be called statically, assuming $this from incompatible context in /usr/local/lib/php/Mail/mimePart.php on line 842
[23-Aug-2015 21:31:18 America/Detroit] PHP Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in /home/test_user/public_html/example/mime.php on line 1333
[23-Aug-2015 21:31:18 America/Detroit] PHP Fatal error: Class 'Mail' not found in /home/test_user/public_html/example/mms.php on line 27