swiftmailer

How to handle Swift_TransportException in Silex

删除回忆录丶 提交于 2019-12-21 06:06:49
问题 I'm having quiet weird problem with catching SwiftMailer's exceptions in Silex. I want to send an email like this: try { $message = \Swift_Message::newInstance() ->setSubject('subject') ->setFrom(array('form')) ->setTo(array('to')) ->setBody('body'); $app['mailer']->send($message); } catch (\Swift_TransportException $e) { $app['logger']->addError('Unable to send welcome email'); } I know it's not going to send any email on localhost and I'm expecting it to fail but why I can't catch the Swift

What is the correct configuration for Monolog / Swiftmailer Html Formatter in Symonfy2?

◇◆丶佛笑我妖孽 提交于 2019-12-21 04:16:07
问题 I'm having trouble setting up Monolog to use Swiftmailer and the Html formatter. I have multiple monolog handlers and swiftmail mailers which might be the issue. Here's my config.yml Monolog section: services: monolog.formatter.html: class: Monolog\Formatter\HtmlFormatter monolog: channels: ["orders", "support"] handlers: # Called orders: type: stream path: "%kernel.logs_dir%/%kernel.environment%_orders.log" level: info channels: orders # Called support: type: fingers_crossed action_level:

Add mail to Send folder with SwiftMailer

ぐ巨炮叔叔 提交于 2019-12-21 03:01:25
问题 I'm using SwiftMailer for PHP from swiftmailer.org Everything works well but I wonder if there is a way to add the sent message into the sent folder from the mail account that SwiftMailer is sending from? That's all, have a nice day. 回答1: According to the developer, swiftmailer cannot copy to Sent folder because it is a mail sender and not mailbox manager. As mentioned on the github page: Swiftmailer is a library to send emails, not to manage mailboxes. So, this is indeed out of the scope of

Sending an HTML email using Swift

谁说我不能喝 提交于 2019-12-20 19:41:50
问题 I would like to send an auto-generated email with HTML body from my application using Swift. Here is my current code: $message = Swift_Message::newInstance() ->setFrom(array('dummy1@test.com' => 'John Doe')) ->setTo('dymmy2@test.com') ->setSubject('some subject'); $message->setBody($this->getPartial('global/mail_partial')); $this->getMailer()->send($message); I had already tried to change the header Content-type of the email message using some specific Swift methods but it is not working. 回答1

swift mailer error 'Swift_RfcComplianceException' on an email that actually works?

只愿长相守 提交于 2019-12-20 12:05:52
问题 My swift mailer plugin has just thrown up an error because an email address it tried to send to isn't compliant. Problem is - the email is valid. Basically, I don't want swift mailer to be checking whether or not the email is valid I'd like it send regardless. Is that possible? here is the code which has the function which displays the error but I don't know if what I would need to change is in here or not (kinda a hack programmer :| ) //@require 'Swift/Mime/Headers/AbstractHeader.php'; //

swiftmailer configuration for more than one accounts in Symfony 2

徘徊边缘 提交于 2019-12-19 21:48:38
问题 I use gmail to send mails ,so I config ‘config.yml’ like this swiftmailer: transport: %mailer_transport% encryption: %mailer_encryption% auth_mode: %mailer_auth% host: %mailer_host% username: %mailer_user% password: %mailer_password% ‘parameters.yml’ like this mailer_transport: smtp mailer_encryption: ssl mailer_auth: login mailer_host: smtp.gmail.com mailer_user: lee@gmail.com mailer_password: ****** Now I want to use more mail accounts to send mails for different goals. eg:Use lee@gmail.com

Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.gmail.com [Connection timed out #110]'

寵の児 提交于 2019-12-19 21:44:35
问题 I had already searched it in google and tried all the suggestions here in StackOverflow but I still get a Fatal Error: I am using SwiftMailer for sending and email to GMAIL . It works perfectly on my localhost but when I uploaded it and try It gives me a Fatal Error: Here is a part of my code: require_once 'Swift-5.1.0/lib/swift_required.php'; $email = "fromemail@gmail.com"; $transport = Swift_SmtpTransport::newInstance('ssl://smtp.gmail.com', 465); $transport->setUsername("username@gmail.com

CakePHP SwiftMailer SMTP TLS OpenSSL Error SSL3_GET_RECORD:wrong version number

情到浓时终转凉″ 提交于 2019-12-19 07:19:31
问题 I'm attempting to send an email using the CakePHP SwiftMailer component I found here: http://bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments-and-plugins The server I'm sending to is using SMTP with TLS over port 25. Here's the error I get when I attempt to send a mail: Notice (8): Trying to get property of non-object [APP/views/helpers/hdl_session.php, line 14] Warning (2): stream_socket_client() [function.stream-socket-client]: SSL

MPDF E-mail Attachment Sends Blank PDF

狂风中的少年 提交于 2019-12-19 04:20:37
问题 I have successfully generated a PDF using mpdf, which I have verified by downloading the PDF. However, when I send the PDF as an e-mail attachment I receive a blank PDF with an "Out of Memory" error by Adobe Reader. Below is my code: <?php include("MPDF57/mpdf.php"); ob_start(); include "Receipt_Template_2.php"; $template = ob_get_contents(); ob_end_clean(); $mpdf=new mPDF('','A4','','',32,25,27,25,16,13,'L'); mpdf->WriteHTML($template); $content = $mpdf->Output($template, 'S'); $content =

swiftmailer send email using gmail with custom domain

我的梦境 提交于 2019-12-18 17:39:03
问题 In symfony2.3 I am using swiftmailer. I have a Google Apps address like myname@abc.com and my normal gmail address myname@gmail.com When using: mailer_transport: smtp mailer_encryption: ssl auth_mode: login mailer_host: smtp.gmail.com mailer_user: myname mailer_password: pymass the configuration works great and it sends emails from my gmail address but using myname@abc.com as mailer_user with correct password doesn't work. Any ideas? 回答1: The configuration for sending from (what I assume is)