Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从magento2发送电子邮件_Php_Email_Magento2 - Fatal编程技术网

Php 从magento2发送电子邮件

Php 从magento2发送电子邮件,php,email,magento2,Php,Email,Magento2,我正在尝试从magento 2中的代码发送电子邮件,如下所示: $testo_email = ''; ini_set("sendmail_from", "noreply@test.com"); $from = "Sito Web www.test.com"; $oggetto = "Richiesta di contatto da sito"; $header = "From: indirizzo sito web <www.test.com>\n"; $header .= "X

我正在尝试从magento 2中的代码发送电子邮件,如下所示:

$testo_email = '';
ini_set("sendmail_from", "noreply@test.com");
$from = "Sito Web www.test.com";

$oggetto = "Richiesta di contatto da sito";

$header = "From: indirizzo sito web <www.test.com>\n";
$header .= "X-Mailer: Il nostro Php\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: text/html; charset=\"utf-8\"\n";
$header .= "Content-Transfer-Encoding: 7bit\n\n";

if(mail('mymail@gmail.com', $oggetto, $testo_email, $header)){
echo("Your message has been sent successfully");
} else {
print_r(error_get_last());
}
$testo_email='';
ini_集(“发送邮件自”noreply@test.com");
$from=“Sito Web www.test.com”;
$oggetto=“Richiesta di contatto da sito”;
$header=“From:indirizzo sito web\n”;
$header.=“X-Mailer:Il nostro Php\n”;
$header.=“MIME版本:1.0\n”;
$header.=“内容类型:text/html;字符集=\“utf-8\”\n”;
$header.=“内容传输编码:7bit\n\n”;
如果(邮寄)mymail@gmail.com“,$oggetto,$testo_email,$header)){
echo(“您的邮件已成功发送”);
}否则{
打印(错误获取上次());
}
我将返回以下错误: 数组([type]=>8[message]=>unserialize():偏移量0处的错误,共1个字节[file]=>/var/www/html/app/code/Magiccart/Alothemes/view/frontend/templates/themecfg.phtml[line]=>17)

有人能告诉我我怎么了吗


谢谢。

无效的序列化。是否在$testo_邮件变量中填写了测试字符串?序列化无效。您是否在$testo_邮件变量中填写了测试字符串?