swiftmailer

Why is SwiftMailer sending two emails?

梦想与她 提交于 2019-12-23 14:41:46
问题 I am sending emails via PHP's SwiftMailer library. I have this PHP code to send 1 email to 1 email recipient from 1 sender. Here is the code: $email = /*some email recipient*/; $sendEmail = /*sender's email*/; $sendName = /*sender's name*/; $subject = /*email subject*/; $body = /*email body*/; //Create the message //Create the Transport $transport = Swift_SmtpTransport::newInstance('/*mail host*/', /*port*/) ->setUsername('/*some username*/') ->setPassword('/*some password*/') ; //Create the

Swift mail from Symfony Command

折月煮酒 提交于 2019-12-23 08:46:17
问题 I try to send a Swift mail from the commandline using a Symfony command. Though I get the following exception. Fatal error: Call to undefined method Symfony\Bundle\TwigBundle\Debug\TimedTwigE ngine::renderView() in ... A container is added to this class which I got from the command that is made ContainerAwareCommand The code of the function lookslike this: private function sendViaEmail($content) { $message = \Swift_Message::newInstance() ->setSubject('Hello Email') ->setFrom('123@gmail.com')

Swift mail from Symfony Command

拜拜、爱过 提交于 2019-12-23 08:46:07
问题 I try to send a Swift mail from the commandline using a Symfony command. Though I get the following exception. Fatal error: Call to undefined method Symfony\Bundle\TwigBundle\Debug\TimedTwigE ngine::renderView() in ... A container is added to this class which I got from the command that is made ContainerAwareCommand The code of the function lookslike this: private function sendViaEmail($content) { $message = \Swift_Message::newInstance() ->setSubject('Hello Email') ->setFrom('123@gmail.com')

Should I use PHPMailer or SwiftMailer? [duplicate]

强颜欢笑 提交于 2019-12-23 07:32:48
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: PhpMailer vs. Swiftmailer? I have always used PHP's built in mail() function and it has always worked for me without fail and does the job I want it to. Now some maybe thinking 'Why fix something that isn't broke ?'. My answer to these in case someone asks is: I have never used a framework before if that's what they are classified as or perhaps they are called a library I don't know. I want to start using one

How to use Google analytics to track open rates, click rates in a email?

最后都变了- 提交于 2019-12-23 02:23:05
问题 I have read the document and there is a track code should be able to help me. However, how can i actually use it to get the open rates, url click rates ? For the open rates : I am using swiftmailer to send the mail, is it a way to add the track code (How? Since mail is plain html , no javascript or php is allowed) What i should do in the html/text mail template? For the url click rates : Is it separate from the mailing? that means i just have to add the link in the page i append in the mail.

Init application component with config from database

a 夏天 提交于 2019-12-22 17:02:03
问题 I'm building a Yii2 application that sends email through the swiftmailer extension. I store the email settings (smtp, ssl, username, etc..) in a database table, to be able to edit them with an apposite view. How can I init swiftmailer with config from the db table? Thank you. 回答1: You can initialize application components using set() method available through application object Yii::$app : use Yii; ... // Get config from db here Yii::$app->set('mailer', [ 'class' => 'yii\swiftmailer\Mailer',

SwiftMailer Connection could not be established with host smtp.mailgun.org [closed]

家住魔仙堡 提交于 2019-12-22 12:14:39
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . If i use $transport = Swift_SmtpTransport::newInstance('localhost', 25); then it's working fine but when i'm using this settings it's not working $transport = Swift_SmtpTransport::newInstance('smtp.mailgun.org', 465, 'ssl') ->setUsername('mailegun username') ->setPassword('mailgun password'); This problem is in

Unittesting Laravel 5 Mail using Mock

瘦欲@ 提交于 2019-12-22 06:16:22
问题 Is there a way to test Mail in Laravel 5? tried the only legit Mock example I see on the internet but it seems it only works on Laravel 4. current code below. $mock = Mockery::mock('Swift_Mailer'); $this->app['mailer']->setSwiftMailer($mock); ...some more codes here... $mock->shouldReceive('send')->once() ->andReturnUsing(function($msg) { $this->assertEquals('My subject', $msg->getSubject()); $this->assertEquals('foo@bar.com', $msg->getTo()); $this->assertContains('Some string', $msg->getBody

How to send mail to multiple recipients in Yii2 mailer OR how to add setCc in yii2 mailer

北城余情 提交于 2019-12-22 04:09:08
问题 How to send mail to multiple recipients in Yii2 mailer? This code for a multiple recipient but not working. $value = Yii::$app->mailer->compose() ->setFrom([$this->email => $this->name]) ->setTo(array($model->email_1,$model->email_2)) ->setSubject($model->status) ->setHtmlBody($model->description) ->send(); How to add setCc in yii2 mailer? This code for adding setCc but this is also not working. $value = Yii::$app->mailer->compose() ->setFrom([$this->email => $this->name]) ->setTo($model-

Swiftmailer config : send mail using gmail

自古美人都是妖i 提交于 2019-12-21 20:58:23
问题 I can send email from my pc using swiftmailer, but mail not sending in server. I'm using swiftmailer 5.0.1. Project details are, A simple php project in netbeans swiftmailer 5.0.1 twig 1.13.1 My code is public function init() { $this->username = 'username@gmail.com'; $this->password = 'password'; $this->host = 'ssl://smtp.gmail.com'; $this->port = 465; $this->from = 'username@gmail.com'; $this->subject = 'Company - contact'; $this->body_part_type = 'text/html'; } public function send_email(