<?php
require_once 'swiftmailer/swift_required.php';
require_once('dompdf/dompdf_config.inc.php');
spl_autoload_register('DOMPDF_autoload');
date_default_timezone_set('Asia/Manila');
function pdf_create($html,$filename,$stream = TRUE){
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$output = $dompdf->output();
file_put_contents('puja.pdf', $output);
}
$tym = date('g:i s');
$filename = 'print'.$tym;
$dompdf = new DOMPDF();
$html = file_get_contents('vamshi.php');
pdf_create($html,$filename);
?>
<?php
// Create the mail transport configuration
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com',465,'ssl')
->setUsername('rajeshchintu.14@gmail.com')
->setPassword('9397343655');
// Create the message
$message = Swift_Message::newInstance()
->setTo(array('saivamshigupta@gmail.com' =>'vamshi'))
->setSubject("Registration Success !")
->setBody("You have Registered Successfully ! Thank You For Registering With Us.Click link to confirm your account",'text/html')
->setFrom("rajeshchintu.14@gmail.com", "Rajesh")
->attach(Swift_Attachment::fromPath('/full/file/path/puja.pdf'));
// Send the email
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);
if($mailer){
echo 'eafbaefdbaifhefj';
}
?>
致命错误:未捕获的异常&#39; Swift_TransportException&#39;同 消息&#39;预期的响应代码250但是得到了代码&#34; 535&#34;,带有消息 &#34; 535-5.7.8不接受用户名和密码。在535 5.7.8了解更多信息 https://support.google.com/mail/answer/14257 g74sm5822247pfj.1 - gsmtp &#34;&#39;在 C:\ XAMPP \ htdocs中\ PHPLab \新\ swiftmailer \类\雨燕\传输\ AbstractSmtpTransport.php:382 堆栈跟踪:#0 C:\ XAMPP \ htdocs中\ PHPLab \新\ swiftmailer \类\雨燕\传输\ AbstractSmtpTransport.php(279): Swift_Transport_AbstractSmtpTransport-&GT; _assertResponseCode(&#39; 535-5.7.8 用户...&#39;,数组)#1 C:\ XAMPP \ htdocs中\ PHPLab \新\ swiftmailer \类\雨燕\传输\ EsmtpTransport.php(243): Swift_Transport_AbstractSmtpTransport-&GT; executeCommand(&#39; RSET \ r \ n&#39 ;, 数组,数组)#2 C:\ XAMPP \ htdocs中\ PHPLab \新\ swiftmailer \类\雨燕\传输\ ESMTP \身份验证\ XOAuth2Authenticator.php(54): Swift_Transport_EsmtpTransport-&gt; executeCommand(&#39; RSET \ r \ n&#39;,数组)#3 C:\ XAMPP \ htdocs中\ PHPLab \新\ swiftmailer \类\雨燕\传输\ ESMTP \ AuthHandler.php(177): Swift_Transport_Esmtp_A in C:\ XAMPP \ htdocs中\ PHPLab \新\ swiftmailer \类\雨燕\传输\ AbstractSmtpTransport.php 在第382行
答案 0 :(得分:0)
那么这对我意味着什么?
要解决此问题,您可以设置自己的Google帐户,以便为不太安全的应用程序发送电子邮件。
您可以在此处https://myaccount.google.com/security
执行此操作或者您可以使用另一个smtp服务器发送电子邮件
这是我基于yii2框架回答的类似问题 https://stackoverflow.com/a/35908151/2536812