나는 누군가가 이것을 도와 줄 것을 정말로 바랍니다. 내 문제의 원인이 무엇인지 모르겠습니다. 하지만 오류가 있습니다.
SMTP 오류 : SMTP 호스트에 연결할 수 없습니다. 메일 오류-> SMTP 오류 : SMTP 호스트에 연결할 수 없습니다.
미리 감사드립니다. 도움을 주셔서 감사합니다.
<?php
require_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->CharSet = "utf-8";
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "vanishingdrive";
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = "465";
$mail->setFrom('[email protected]', 'Francis');
$mail->AddAddress('[email protected]', 'Arnold');
$mail->Subject = 'using PHPMailer';
$mail->IsHTML(true);
$mail->Body = 'Hi there ,
<br />
this mail was sent using PHPMailer...
<br />
cheers... :)';
if($mail->Send())
{
echo "Message was Successfully Send :)";
}
else
{
echo "Mail Error - >".$mail->ErrorInfo;
}
?>
에서 최신 버전을 다운로드 이
그리고 이것을 사용하십시오;
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // your domain username
$mail->Password = 'pass'; // your address password
//$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
$mail->setFrom('[email protected]', 'Mailer'); //your domain addres
$mail->addAddress('[email protected]', 'Joe User'); // Add a recipient
//$mail->addAddress('[email protected]'); // Name is optional
$mail->addReplyTo('[email protected]', 'Information');
//$mail->addCC('[email protected]');
//$mail->addBCC('[email protected]');
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
보안 설정을 열 었는지 확인하십시오. https://myaccount.google.com/lesssecureapps?pli=1
또한 $mail->SMTPSecure = 'tls';
설정을 열 때이 부분 을 열지 마십시오 ..
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다