2011-10-14 53 views
0

我已經創建了發送郵件的頁面,我正在使用PHP的郵件功能。但是當我運行腳本時,我無法發送郵件。通過PHP郵件功能發送郵件

我有一個發送郵件鏈接在這個頁面http://vijayatech.freevnn.com/index.php 當我點擊這個鏈接它被重定向到http://vijayatech.freevnn.com/mail.php我在哪裏我的代碼發送郵件。

我發送郵件的代碼如下: 這個代碼是在我的mail.php:

$message="hello"; 

$subject="hi"; 

$headers = 'MIME-Version: 1.0' . "\r\n"; 

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 

mail('[email protected]',$subject,$message,$headers); 

我在freevnn.com一個免費域名 請人幫助我,告訴我是什麼問題

在此先感謝。

+0

也許這封電子郵件在運送30秒後自毀? –

回答

0

該代碼適用於我。有一件事你可能想要添加到標題是:來自:[email protected]

<?php 

$message="hello"; 

$subject="hi"; 

$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 

$headers .= 'From: John Smith <[email protected]>' . "\r\n"; 
$mail = mail('[email protected]',$subject,$message,$headers); 

if ($mail == 1) echo "Mail was sent"; 
else echo "Mail was NOT sent"; 

希望是有幫助的。也請嘗試檢查您的垃圾郵件文件

+0

它顯示「郵件沒有發送」我有一個服務器的問題。 –

+0

我剛剛上傳我的網頁在服務器上,我必須做一些與郵件服務器我的域名是http://www.freevnn.com。 –

+0

我沒有在這臺服務器上的電子郵件帳戶,因爲它是一個免費的域名,他們不提供免費用戶的電子郵件帳戶可以這是一個問題。 –