Gmail을 사용하여 이메일을 보내려면 SwiftMailer 4.1.6을 다운로드했습니다. 그 목적을 위해 다음 코드를 작성했습니다. 스위프트 메일러, GMail 및 PHP, 권한 거부 오류로 이메일 보내기
<?php
require_once 'swiftmailer/lib/swift_required.php';
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl")
->setUsername('[email protected]')
->setPassword('***********');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Wonderful Subject')
->setFrom(array('[email protected]' => 'Jomit Jose'))
->setTo(array('[email protected]' => 'Jomit Jose'))
->setBody('This is the text of the mail send by Swift using SMTP transport.');
$numSent = $mailer->send($message);
printf("Sent %d messages\n", $numSent);
이 있으며 다음 오류가 발생했습니다 : 수 있었다 무엇
Fatal error: Uncaught exception 'Swift_TransportException' with message
'Connection could not be established with host smtp.gmail.com
[Permission denied #13]' in
/home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:266
Stack trace:
#0 /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(66):
Swift_Transport_StreamBuffer->_establishSocketConnection()
#1 /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(117):
Swift_Transport_StreamBuffer->initialize(Array)
#2 /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Mailer.php(79):
Swift_Transport_AbstractSmtpTransport->start()
#3 /home/jomit/public_html/email_test/test.php(16):
Swift_Mailer->send(Object(Swift_Message))
#4 {main} thrown in /home/jomit/public_html/email_test/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 266
는 잘못?
시도 포트는 443 대신 465 – maxjackie
@maxjackie 아차의를 사용! 또한 다음과 같은 오류가 발생합니다 :'Uncaught exception 'Swift_TransportException'with message '호스트 smtp.gmail.com과 연결을 설정할 수 없습니다 [Permission denied # 13]' ' – Jomoos
PHP 설정이 SSL을 지원합니까? –