PHP 및 로컬 메일 서버 인 hMailServer에서 SwiftMailer 패키지 사용. PHP 코드 :왜 Swift Mailer가 암호없이 메시지를 보냅니 까?
<?php
require 'vendor/autoload.php';
$message=Swift_Message::newInstance();
$message->setFrom('[email protected]');
$message->setTo(array('[email protected]'=>'Ilqar Rasulov'));
$message->setSubject('Delicious New Recipe');
//$message->setBody(<<<_TEXT_
//Dear James,
//You should try this: puree 1 pound of chicken with two pounds
//of asparagus in the blender, then drop small balls of the mixture
//into a deep fryer. Yummy!
//Love,
//Julia
//_TEXT_
//);
$message->addPart(<<<_TEXT_
<p>Dear James,</p>
<p>You should try this:</p>
<ul>
<li>puree 1 pound of chicken with two pounds
of asparagus in the blender</li>
<li>then drop small balls of the mixture into a deep fryer.</li>
</ul>
<p><em>Yummy!</em></p>
<p>Love,</p>
<p>Julia</p>
_TEXT_
, "text/html");
try{
$transport= Swift_SmtpTransport::newInstance('localhost',25);
$mailer= Swift_Mailer::newInstance($transport);
$mailer->send($message);
} catch (Exception $ex){
print $ex->getMessage();
}
내 hMailServer를 구성하고 암호 (관리자 및 계정 암호)를 지정했습니다. 따라서 swiftmailer가 호스트 이름과 암호만으로 작업을 수행하고 인증을 요구하지 않는 이유는 무엇입니까? 사촌 나는 모든 설정 파일에 사용자 이름과 패스워드를 저장했다는 것을 기억하지 못한다.
그래서이 시점까지 메일 서버에 들어 가지 않고 메일을 보냈습니까? 나는 "에서"어떤 unexisting 주소로 변경하고 일했습니다! 변형으로 변경 한 후 사용자 이름과 비밀번호를 확인하기 시작했습니다. 답변 주셔서 감사합니다. 이제 어떻게 작동하는지 알게되었습니다. –