swiftmailer

SwiftMailer does not send mail, why?

会有一股神秘感。 提交于 2019-12-05 03:31:04
SwiftMail does not send my email, while mail() does work. Same as here . I added the EchoLogger but it does not print anything. $message = Swift_Message::newInstance(); $message->setSubject('Test'); $message->setTo( $email ); $message->setFrom(ABSENDER); $message->setBody($nl_text); $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $logger = new Swift_Plugins_Loggers_EchoLogger(); $mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger)); $result = $mailer->send($message, $failures); var_dump($failures); The email is returned in $failures

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

試著忘記壹切 提交于 2019-12-05 02:36:38
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->email_1) ->setCc($model->email_2) ->setSubject($model->status) ->setHtmlBody($model->description) ->send()

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

你说的曾经没有我的故事 提交于 2019-12-05 01:10:40
问题 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'); 回答1: I found the solution and posted

Disable swiftmailer spool in Symfony per environment

心已入冬 提交于 2019-12-05 00:52:36
I having trouble send bulk emails with symfony2 via console command. I want to disable the mail spooling complete for the env the console is running in but keep it working for the default env. So I have this in config.yml: swiftmailer: transport: %mailer_transport% host: %mailer_host% port: %mailer_port% username: %mailer_user% password: %mailer_password% spool: %mailer_spool_type% and then each env has it's on parameters like parameters_prod.yml: parameters: mailer_transport: smtp mailer_host: smtp.someserver.net mailer_port: 587 mailer_user: "someuser" mailer_password: "somepassword" mailer

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

南笙酒味 提交于 2019-12-04 17:38:44
问题 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

Swiftmailer config : send mail using gmail

放肆的年华 提交于 2019-12-04 16:42:19
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($from_name_add, $to_add, $fullname, $email, $mobile, $content) { $this->init(); $transport = Swift

Swift Mailer attachments

跟風遠走 提交于 2019-12-04 11:10:27
I'm creating a CSV on the fly with PHP, I then need to attach this CSV file to the the Swift Mailer Message. I have tried using file_get_content on the created file aswell as using chunk_split(base64_encode(file_get_contents()) on the created file aswell as attaching the file before writing it to disk. Without writing to disk I get Rescource #183 in the CSV, with attaching it with file_get_content I get just a string in each row of the CSV file, anyone know what I'm doing wrong? if(!file_exists(_PS_ORDERS_DIR_.$orderDate.'/'.$file_name.'.csv')) { if($file = fopen (_PS_ORDERS_DIR_.$orderDate.'/

Gmail locks account when sending mail via Laravel

。_饼干妹妹 提交于 2019-12-04 11:09:34
问题 When I try to send an e-mail through my website running Laravel 4, I get this exception: Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 wd7sm12843789wjc.36 - gsmtp " Here is my mail config: return array( 'driver' => 'smtp', 'host' => 'smtp.gmail.com', 'port' => 465, 'from' => array('address' => 'mymail@gmail.com', 'name' => 'myname'), 'encryption' =>

add inline image to a message sent with swiftmailer

天涯浪子 提交于 2019-12-04 11:04:21
问题 Please excuse my php but, Im using Swiftmailer to send emails from a clients website. They've requested to add an image or two as a signature etc and so looking at the swiftmailer spec here http://swiftmailer.org/docs/messages.html They suggest either adding an inline image like this $message->embed(Swift_Image::fromPath('http://site.tld/image here')) or like this(in 2 steps) $cid = $message->embed(Swift_Image::fromPath('image here')); then in the emails body section add <img src="' . $cid .

Adding line breaks to a text/plain email

强颜欢笑 提交于 2019-12-04 09:53:22
问题 I'm having a problem sending a plain text (not HTML !) email, all my line breaks are being ignored: ->setBody('Did you request a password reset for your account?\r\n\r\nIf yes, click here:\r\nhttp://www.website.com', 'text/plain'); The above is being displayed in the email as: Did you request a password reset for your account?\r\n\r\nIf yes, click here:\nhttp://www.website.com I've checked and the header is apparently set correctly: Content-Type: text/plain; charset=utf-8 Does anyone have any