2017-06-22 67 views
0

工作對我來說這是我的模板代碼,它是不是在WordPress的發送郵件給客戶。請任何人都幫我做出正確的代碼。謝謝wp_mail()是不是在WordPress

<?php 
/* 
Template name: contact 
*/ 
get_header(); 
$email="[email protected]"; 
$subject="testing"; 
$message = "hi this is test"; 
$headers = 'From:' . "[email protected]"; 

if(wp_mail($email, $subject, $message, $headers)) 
{ 
echo "sending mail test"; 
} 
else 
{ 
    echo "not"; 
} 

get_footer(); 
?> 
+0

你有訪問PHP的日誌文件的問題? [如何找到日誌文件(https://stackoverflow.com/questions/5127838/where-does-php-store-the-error-log-php5-apache-fastcgi-cpanel) –

回答

0

我檢查了腳本,它的工作。也許你有服務器上的問題。

+0

感謝哥哥是的,它是服務器問題 – Vishal

+0

不用客氣=) –

0

這是因爲你沒有使用PHP的標準郵件功能。這個插件將幫助你。 WP mail SMTP

選擇「使用PHP郵件功能來發送電子郵件」設置頁上的選項,並檢查電子郵件。

0

嘗試設置頭

$headers[] = 'Content-type: text/plain; charset=utf-8'; 
$headers[] = 'From:' . "[email protected]"; 

它可以與你的服務器(主機)