swiftmailer

SwiftMailer Batch email times my Server out

喜欢而已 提交于 2019-12-04 09:22:10
I realise that batchEmail is no longer part of the new SwiftMailer. So I made this script: <? // // GC PRESS EMAILER v5 // ini_set('display_errors',1); error_reporting(E_ALL); require_once("config.php"); include_once("hawkmail/mail/lib/swift_required.php"); $c=mysql_connect($dbh,$dbu,$dbp); function SendEmail(){ // DB $s=mysql_query("SELECT * FROM `newgc`.`press_list`"); // Process Color Listing Loop while($r=mysql_fetch_array($s)){ // ########################### // START LOOP // ########################### $name=$r['name']; $email=$r['email']; $to=array(''.$email.''=>''.$name.''); include(

How to handle Swift_TransportException in Silex

巧了我就是萌 提交于 2019-12-03 22:09:14
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_TransportException exception in try - catch block? It just prints: Fatal error: Uncaught exception

How to spool emails (in a task) and send normal emails in the moment in the other controllers?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 16:47:57
In my application we send notification emails at the moment, for example, when your registry, or when need to confirm some information via email. But also we need to send personalized emails (only differenced in one text) for a hundreds of users, but I do not know how to combine Symfony2 spool email with no spool email in the same project. There are something like a parameter when sending the email to indicate this? Something like $email->send('no-spool'); David Barreto I found the solution and posted here: How to define an additional mailer service to use the spool and send instant emails in

Symfony2 Swiftmailer Not Sending

风流意气都作罢 提交于 2019-12-03 15:12:02
问题 I am having trouble sending emails with symfony2 and swiftmailer. I am also a bit lost on how to debug this issue. Below is the code. First I am creating a form to display. On submit (request->method == post) I then try to send the email. I am getting no errors and it is taking me to the thankyou page, however, I am not receiving any email. I have tested on prod and dev. In dev I have opened the profiler after submission and it shows 0 emails. Any help is appreciated! Thanks! public function

How to test email in functional test (Symfony2)

折月煮酒 提交于 2019-12-03 13:55:35
I'm trying to test email in functional test... My source code is the same as the example of the cookbook , the controller : public function sendEmailAction($name) { $message = \Swift_Message::newInstance() ->setSubject('Hello Email') ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody('You should see me from the profiler!') ; $this->get('mailer')->send($message); return $this->render(...); } And the test : // src/Acme/DemoBundle/Tests/Controller/MailControllerTest.php use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class MailControllerTest extends WebTestCase { public

How to send spool from swiftmailer without using command

谁说胖子不能爱 提交于 2019-12-03 13:47:07
How to send spool from swiftmailer without using command? php app/console swiftmailer:spool:send --env=prod I need to put this somehow into php file so that Server admin can add this to Schedule. Just do the same that the command does. From the command Execute() function: $mailer = $this->getContainer()->get('mailer'); $transport = $mailer->getTransport(); if ($transport instanceof \Swift_Transport_SpoolTransport) { $spool = $transport->getSpool(); if ($spool instanceof \Swift_ConfigurableSpool) { $spool->setMessageLimit($input->getOption('message-limit')); $spool->setTimeLimit($input-

Batch Send Email with SwiftMailer

限于喜欢 提交于 2019-12-03 13:25:39
问题 I'm currently using SwiftMailer to send out emails to several users (up to 50). I have it set up and working properly, however, I'm not quite sure how to pull the recipients from my MySQL database and iterate to send them. Here is what I currently have: <?php require_once 'swift/lib/swift_required.php'; $mailer = Swift_Mailer::newInstance( Swift_SmtpTransport::newInstance('smtp.connection.com', 25) ->setUsername('myUserName') ->setPassword('myPassword') ); $mailer->registerPlugin(new Swift

Attempted to call an undefined method named “newInstance” of class “Swift_Message”

最后都变了- 提交于 2019-12-03 11:10:53
Since a few days I can't send email anymore using Symfony and Swiftmailer, though I'm using the code from the documentation private function _sendResetPasswordEmail(UserInterface $user) { $subject = $this->get('translator')->trans('email-title-reset-password'); $message = \Swift_Message::newInstance() ->setSubject($subject) ->setFrom('contact@example.com') ->setTo($user->getEmail()) ->setBody( $this->renderView( 'reset-password-email.html.twig', ['user' => $user] ), 'text/html' ) ; $this->get('mailer')->send($message); } and it used to work and now I can see in the logs "Attempted to call an

PHP Library to read email

人盡茶涼 提交于 2019-12-03 07:32:23
问题 I currently use the SwiftMailer library to send email, but unfortunately it's only for sending, not receiving. I'm wondering... is there a similar library to connect via IMAP to an email account and read the email (IE give me the ability to loop through email). I'm aware there are a set of PHP IMAP functions located here: http://us3.php.net/manual/en/book.imap.php But my question is, does anybody know of an alternative libarary or IMAP wrapper class for receiving/viewing all your emails? I

Sending email with Swift Mailer, GMail and PHP, Permission Denied Error

只谈情不闲聊 提交于 2019-12-03 07:19:50
I downloaded SwiftMailer 4.1.6 for sending email using Gmail. I had written the following code for that purpose. <?php require_once 'swiftmailer/lib/swift_required.php'; $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl") ->setUsername('jomit.jmt@gmail.com') ->setPassword('***********'); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance('Wonderful Subject') ->setFrom(array('jomit.jmt@gmail.com' => 'Jomit Jose')) ->setTo(array('jomit.jmt@gmail.com' => 'Jomit Jose')) ->setBody('This is the text of the mail send by Swift using SMTP