草庐IT

swiftmailer

全部标签

php - Yii2 密码重置不起作用

我使用Windows和Yii2.0.13.1以及xampp和php7.1.4。登录时,我点击重置链接并输入我的电子邮件并发送,我遇到了这个错误:Swift_TransportExceptionProcesscouldnotbestarted[Thesystemcannotfindthepathspecified.]我的common/config/main-local.php是:'mailer'=>['class'=>'yii\swiftmailer\Mailer','viewPath'=>'@common/mail',//sendallmailstoafilebydefault.You

php - 如何保存 Swiftmailer 发送的所有电子邮件

我正在构建一个Symfony2网络应用程序。我的电子邮件是通过Swiftmailer发送的。因为在我的网络应用程序的最新版本中,我在数据库中记录了邮件程序类/函数发送的所有电子邮件以进行跟踪(查看系统是否正常工作并有一定的证据证明我的电子邮件至少已发送),我想在这个版本中做同样的事情。那时,我正在使用PHPMailer,我将其包装在一个函数中以包含PDO调用。现在使用Symfony和Swiftmailer,我想知道我如何能够轻松地将所有电子邮件记录在我的数据库中,当然还有doctrineORM。我想最简单的方法是每次发送电子邮件时手动记录它,但我希望它自动完成,因为我将发送大量电子邮件

php - 未设置 SendGrid 类别

我正在重做一个为邮件集成了SendGrid的项目。好吧,我正在使用Laravel和Mailable类,并且我创建了一个函数来设置SendGrid类别:publicfunctionsetSendgridCategory($category){$encodedCategory=json_encode(['category'=>$category]);$this->withSwiftMessage(function(\Swift_Message$message)use($encodedCategory){$message->getHeaders()->addTextHeader('X-SMT

php - Swift Mailer 有问题不发送消息

我的swiftmailer有问题,它没有向用户发送消息我将库提取到我网站的inc文件夹并创建了以下消息供swiftmailer发送:注意:如果您可以建议除SwiftMailer之外的其他解决方案,请发表评论。require_once'inc/lib/swift_required.php';//CreatetheTransport$transport=Swift_SmtpTransport::newInstance('mail.mywebsite.com',25)->setUsername('info@mywebsite.com')->setPassword('myPassword');

php - 如何使用swift mailer读取模板?

我有一个模板文件(html文件)。我必须在我的邮件中包含此模板。我如何使用swiftmailer读取模板。我试过了$emailBody=readTemplateFile("http://www.something.in/guitar-mail.html");$emailBody_new=str_replace("#name#",$reg_fname,$emailBody);$emailBody_new=str_replace("#email#",$url,$emailBody_new);$message->setBody($emailBody_new);但是在邮件中,html标签和cs

php - 我可以在不发送电子邮件的情况下使用 SwiftMailer 对 SMTP 进行身份验证吗

我正在尝试使用Laravel中的SwiftMailer验证登录凭据。我需要在不实际发送电子邮件的情况下验证SMTP服务器的登录凭据。我正在尝试做这样的事情:$client=Swift_SmtpTransport::newInstance($smtpServer,$smtpPort,'ssl');$client->setUsername($this->smtpUser);$client->setPassword($this->smtpPass);$client->authenticate();Swift_SmtpTransport上没有authenticate()方法,但如果有类似的东西

php - 使用 Yii2 扩展通过 swiftmailer 发送电子邮件

我正在做一个项目,我想测试发送给用户的电子邮件,但到目前为止我还没有成功设置它。我正在使用Codeception并在Vagrant中运行它。我现在想做什么:return\Yii::$app->mailer->compose()->setFrom($from)->setTo($to)->setSubject('Welcome')->send();我有一个main-local.php,它看起来像这样:'mailer'=>['class'=>'yii\swiftmailer\Mailer','viewPath'=>'@common/mail','transport'=>['class'=>'

php - 使用 SwiftMailer 的 text/html 和 text/plain 附件

我正在使用swiftmailer到发送电子邮件,我希望有相同的附件:*HTML版本(text/html)作为内联图像(cid)*文本版本(text/plain)作为附件我正在Ubuntu上使用MozillaThunderbird45.3.0测试电子邮件。我一直在研究->setBody、->addPart、->embed和->attach方法,但我总是破坏其中一个版本(即,我以HTML或文本格式查看邮件,以纯文本格式获取电子邮件)。我的测试代码看起来像(当然有有效的SMTP地址和文件路径):functionswiftMail(){require_once'./vendor/swiftma

php - Swift 邮件默认发件人

我正在尝试为SwiftMailer4.3.0中的所有邮件设置默认发件人,但找不到合适的解决方案。我想避免在每条消息中使用->setFrom(),因为这将是一个令人头疼的问题。我可以为此使用常量,但我一直在寻找更优雅的解决方案。$message=Swift_Message::newInstance()->setSubject('subject')->setFrom(array('sender@domain.com'=>'Sender'))->setTo(array('recipient@domain.com'))->setBody('Message');谢谢!

php - laravel 5邮件发送的Gmail设置

我将其设置为通过laravel5从我的gmail帐户发送邮件。MAIL_DRIVER=smtpMAIL_HOST=smtp.gmail.comMAIL_PORT=587MAIL_USERNAME=********@gmail.com//emailaddressMAIL_PASSWORD="*******"//passwordforthatemailMAIL_ENCRYPTION=tls为了测试邮件发送,我使用了这个Route::get('/email',function(){$data=array('name'=>"Library",);Mail::send('mailview',$d