<?php
SendEmail("[email protected]","Dima", "trololo");
function SendEmail($to,$user_name, $user_password)
{
$subject="Political forum: registration";
$body = 'Your user name is: ".$user_name <br/>'.$user_name.' Your password is: '.$user_password.'<br/><br/> Click the link below for validation: <a href="#">Validation_Link</a>';
$headers="FROM: $to\r\n";
$headers.=" Content=type: text/html\r\n";
if (mail($to, $subject, $body, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
}
?>
無法發送電子郵件!無法與電子郵件()PHP函數以上
我有一個小閱讀,我發現,你需要改變這個inyour php.ini文件:
;僅適用於Win32。 ; http://php.net/smtp SMTP = localhost; http://php.net/smtp-port SMTP_PORT = 25
;僅適用於Win32。 ; http://php.net/sendmail-from sendmail_from = [email protected]
我做到了,但它仍然無法
消息:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\PoliticalForum\StoredProcedure\User\email.php on line 16
郵件傳遞失敗...
「失敗」意味着什麼?任何錯誤消息? –
你有任何錯誤信息嗎?如果是靜默錯誤,請在執行郵件()後嘗試執行var_dump error_get_last() – pduersteler
對不起忘了添加...已添加以上 – Matrix001