问题描述
您好,我是PHP新手,在发送电子邮件时遇到问题。我在使用axios触发功能时收到以下消息:
[messi,ronaldo,rooney,pogba,hazard]
[messi,DATA,hazard]
Access to XMLHttpRequest at 'myServer/EinladungMail.PHP' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
quasar.esm.js?b178:6 POST myServer/EinladungMail.PHP net::ERR_Failed
JS:
<?PHP
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET,POST,PUT');
header('Access-Control-Allow-Headers: Content-Type');
$rest_json = file_get_contents("PHP://input");
$_POST = json_decode($rest_json,true);
$mail = $_POST["mail"];
$message= 'myMessage';
$headers = 'From: nor[email protected]';
$mail($mail,'Einladung',$message,$headers );
预先感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)