EDIT : 코드는 웹 서버에서만 작동하며 localhost에서는 작동하지 않습니다. 따라서 "수정 사항"이 있습니다. = 1)PHPMailer는 한 페이지에서 작동하지만 비슷하게 작동하지 않습니다
require 'PHPMailer/PHPMailerAutoload.php';
$nome = $_POST["nome"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$email = $_POST["email"];
$contacto = $_POST["contacto"];
$body = "<p>Mail recebido de: </p>" . $nome . "<p>Email:</p>" . $email . "<p> Contacto:</p>" . $contacto . "<p>Mensagem:</p>" . $message ;
$mail = new PHPMailer();
$mail->CharSet = "text/html; charset=UTF-8;";
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->CharSet = 'UTF-8';
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->Username = "the email";
$mail->Password = the password;
$mail->SetFrom('the email', 'Organizer');
$mail->Subject = "[ORÇAMENTO] " . $subject;
$mail->Body = $body;
$mail->IsHTML(true);
$mail->AddAddress("the email");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
$sucesso = 'Mensagem enviada com sucesso!';
}
이 첫 번째 스크립트가 자신에게 이메일을 보내지 만, 심지어는 (보내기> 여기 ($ 메일 - 작동하지 않습니다
그래서, 내 PHP 코드는이를 좋아한다으로 작동 여전히 나는) 이메일을 수신하지 않습니다 : 나는 등 데이터베이스에서 얻을 모든 변수를 테스트 한 그들은 모두 올바른require '../PHPMailer/PHPMailerAutoload.php';
$body = "<p>Car(a) " . ${'user' . $i} . ",</p> <p> Foi lhe associado(a) uma nova ocorrência. Consulte-a em http://www.organizer.com.pt . </p>";
$mail = new PHPMailer();
$mail->CharSet = "text/html; charset=UTF-8;";
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->CharSet = 'UTF-8';
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->Username = "the email";
$mail->Password = the password;
$mail->SetFrom('the email', 'Organizer');
$mail->Subject = "Nova Ocorrência";
$mail->Body = $body;
$mail->IsHTML(true);
$mail->AddAddress($email);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
$sucesso = 'Mensagem enviada com sucesso!';
}
, 난 그냥 어떤 이유로 이메일을 수신하지 않습니다 . 누구든지 도울 수 있니?
피씨 : 죄송합니다 일부는 포르투갈어로되어 있습니다. 코드는 여전히 완벽하게 이해할 수 있습니다.
오류 메시지가 있습니까? –
아니, 아마 메일이 전송됩니다, 그 이유는 이해가 안 돼요. – Manuel
체크인 스크립트 2 ... "필요합니다 .. ../PHPMailer/PHPMailerAutoload.php ';" 또는 " 'PHPMailer/PHPMailerAutoload.php';" –