swiftmailer

Failed to authenticate on SMTP server error using gmail

谁说胖子不能爱 提交于 2019-11-30 02:33:26
I'm trying to set up email for my first laravel project, and was thrilled that there's a laracast for it: https://laracasts.com/lessons/mailers I've followed the simple steps, chose gmail in mail.php (x's added for anonymity): 'driver' => env('MAIL_DRIVER', 'smtp'), 'host' => env('MAIL_HOST', 'smtp.gmail.com'), 'port' => env('MAIL_PORT', 587), 'from' => ['address' => 'dianexxxxx@gmail.com', 'name' => 'Diane Kaplan'], 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => 'dianexxxxx@gmail.com', 'password' => 'xxxxx', 'sendmail' => '/usr/sbin/sendmail -bs', 'pretend' => false, .env has (x

SwiftMailer + Gmail - Cannot send email

为君一笑 提交于 2019-11-29 23:29:08
问题 I can't connect with Gmail SMTP server. Look: $transport = Swift_SmtpTransport::newInstance() ->setHost('smtp.gmail.com') ->setPort(465) ->setEncryption('ssl') ->setUsername('email@gmail.com') ->setPassword('mypasss'); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance('Contato via Site') ->setFrom(array($email => $de)) ->setTo(array($destinatario => 'Agência Linka')) ->setBody($corpo_mensagem, 'text/html') ->setCharset('UTF-8'); $mailer->send($message);

SwiftMailer not sending emails in Symfony 2.5

六月ゝ 毕业季﹏ 提交于 2019-11-29 17:08:52
After spending 2 days trying to get it to work, I finally decided to ask here. I am trying to generate an email once the user submits the contact form, upon reading the documentation on Symfony website and countless other articles on stackoverflow and google I just cant get it to work. Looking at the instruction it looks like it should be pretty straight forward but none of the solutions are working. I tried sending emails via Gmail and via our company SMTP but both did not work This is my current parameters.yml swiftmailer: transport: smtp username: username (confirmed that i am entering it

Logging swiftmailer send() activity in symfony2

浪子不回头ぞ 提交于 2019-11-29 17:05:22
问题 Im using swiftmailer for sending mails from my symfony2.2 project. Is there a way to log globally all email info and send results? It would be great if mailer send() method have trigger somę event, but I can't see it does. 回答1: This question was answered already, This solution is better for Symfony 4 combined with Monolog. It is based on umpirsky his Answer. But without the overhead of a custom file logger. Note: Logs will be placed in ./var/logs/... App\Util\MailLoggerUtil.php <?php

Email body in Symfony 1.4 mailer?

女生的网名这么多〃 提交于 2019-11-29 16:04:46
问题 I'm using the Symfony 1.4 mailer where I build the various bits needed for an email and then send it out using: $this->getMailer()->composeAndSend($sender, $recipient, $subject, $body); In the email body, I need to able to take advantage of variables generated in the action, so right now I might have this in my action: $body = 'Your username is '.$username.' and this is the email body.'; Does anyone know of an elegant way of storing/organising various email bodies, instead of having to code

How to set 'FROM' property using Swiftmailer with Gmail?

折月煮酒 提交于 2019-11-29 14:41:43
<?php require_once 'lib/swift_required.php'; $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl') ->setUsername('username@gmail.com') ->setPassword('password') ; $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance('HomeWork') ->setFrom(array('exampleFROM@gmail.com' => 'NAME')) ->setTo(array('exampleTO@gmail.com'=> 'NAME')) ->setBody('Test Message Body') ; $mailer->send($message); ?> It works but sender is 'username@gmail.com'. How can I specify any other email address in order to send fake email? Gmail disallows overriding the FROM name

Changing smtp settings in SwiftMailer dynamically

半城伤御伤魂 提交于 2019-11-29 13:34:27
I'm using SwiftMailer bundle with Symfony 2. I pass my smtp user/password settings in config.yml file, it works great, but I need to take this settings from database, when I'm sending mail. I can acces this params: $mailer = $this->getContainer()->get('mailer')->getTransport(); But is it possible to change them on runtime ? I dont see any setter methods. many thanks! Many thanks, but it's not the solution i was looking, on kernel request I don't know which account I'll use. I needed to change settings inside my send mail loop. I found pretty cool solution: foreach ($locations as $location) { /

swiftmailer and email form with attachment - beginner

懵懂的女人 提交于 2019-11-29 12:41:00
问题 As always here is the place where I have learned a lot. And I have now a new things to learn: I have a html form: <tr><td width="16%">File attachment</td><td width="2%">:</td><td><input type="file" name="fileatt" /></td></tr> and a mail.php: $attachfile=$_POST["fileatt"]; and a correct swiftmailer code to send emails out; I have googled and I found many examples how to send attachment with a file stored on the website but I would like to do it on the fly. So when you submit the button it

Laravel SwiftMailer : Expected response code 250 but got code “530”, with message \"530-5.5.1 Authentication Required

别等时光非礼了梦想. 提交于 2019-11-29 11:04:25
I am using laravel 5.2, And the using Swift Mailer for password resetting. I have 2-step verification on my gmail. . As the google help says : If you've turned on 2-Step Verification for your account, you might need to enter an App password instead of your regular password. I have the following settings on mail.php : return [ 'driver' => env('MAIL_DRIVER', 'smtp'), 'host' => env('MAIL_HOST', 'smtp.gmail.com'), 'port' => env('MAIL_PORT', 465), 'from' => ['address' => 'meaprogrammer@gmail.com', 'name' => 'Shafee'], 'encryption' => env('MAIL_ENCRYPTION', 'ssl'), 'username' => env('meaprogrammer

How to define an additional mailer service to use the spool and send instant emails in Symfony2

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 04:25:11
In my Symfony2 web app I'm supposed to send two kind of emails: instant and bulk. The instant emails should be send right away while the bulk emails should be send using the spool. With the default configuration of the Swiftmailer in Symfony2 it is impossible to do that because there is only one mailer service. Similar questions has been asked here in SO ( How to spool emails (in a task) and send normal emails in the moment in the other controllers? ) with no luck, but according to this github thread ( https://github.com/symfony/SwiftmailerBundle/issues/6 ) it is possible to create a second