Im使用郵件形式,但郵件無法發送到Gmail收件箱!無法發送PHP郵件
這裏是我使用的代碼:
<?php
if (isset($_POST['send'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$emailTo = '[email protected]';
$subject = 'Sujet: '.$name;
$body = "Full Name: $name \n\n Message: $message \n\n Sent by : $email";
$headers = 'De: ' .' <'.$email.'>' . "\r\n";
if(mail($emailTo, $subject, $body, $headers)){
echo "Success";
}else{
echo "Error";
}
}
>
你在使用'localhost'嗎? –
是的!我使用xampp – Mariem
http://stackoverflow.com/q/14802606/725306,http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/,請參閱這[在SO上的答案](http://stackoverflow.com/a/4595838/725306) –