我無法用php mail()函數發送郵件。在ovh共享託管windows服務器上使用php郵件功能
我想使用我的託管郵箱地址:[email protected]_domain.com。
託管是使用Windows服務器的'perso'報價。
使用郵件功能之前在php上做一些配置嗎?
我可以訪問php.ini嗎?
或者可能在ovh manager中檢查/取消勾選。
我已經在谷歌搜索和嘗試一些解決方案,但我發現很多東西,我不知道什麼是有用或不。
我也向OVH技術支持發送了請求,但我仍在等待答案。
現在,我做了一個非常基本的腳本來測試功能,但它並沒有發送郵件:
<?php
$headers ='From: [email protected]_domain.com'."\n";
$headers .='Reply-To: [email protected]_domain.com'."\n";
$headers .='Content-Type: text/plain; charset="iso-8859-1"'."\n";
$headers .='Content-Transfer-Encoding: 8bit';
if(mail('[email protected]', 'test mail', 'Message of the mail', $headers)){
echo 'ok';
}else{
echo 'erreur';
}
?>
您是否收到錯誤或電子郵件? – Brewal
是的,我有一個錯誤。但是,像郵件功能返回true或false,我只是假。沒有關於這個問題的細節。 – tyd01
嘗試在腳本的頂部添加'error_reporting(E_ALL | E_STRICT);'和'ini_set('display_errors',1);'看看你是否更詳細 – Brewal