swiftmailer

swiftmailer send email using gmail with custom domain

依然范特西╮ 提交于 2019-11-30 15:23:40
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? The configuration for sending from (what I assume is) a Google Apps account differs from a Gmail account. Your swiftmailer parameters should look something like

How to close Smtp connection in SwiftMailer

老子叫甜甜 提交于 2019-11-30 13:44:25
问题 I use SwiftMailer to send emails from a gearman worker process. I'm using the Swift_SmtpTransport class to send emails. The problem is that if this worker process stays idle for sometime, the SwiftMailer smtp connection times out. Now when the next job arrives, SwiftMailer fails to send emails as the connection has been timed out. Ideally, I would want to close the smtp connection after every job. I'm unable to locate a api in the class which does this specifically. Neither does unset()

Email body in Symfony 1.4 mailer?

◇◆丶佛笑我妖孽 提交于 2019-11-30 10:46:40
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 them like this straight into my action? I will have many email templates and will also have them in

Swiftmailer mails go into SPAM Folder

萝らか妹 提交于 2019-11-30 09:58:37
$headers = "\r\n" . "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $message = Swift_Message::newInstance() ->setSubject($subject) ->setFrom(array('from@mail.com' => 'From Address')) ->setTo(array('to@mail.com' => 'To Address')) ->setBody($message_plain_txt) ->addPart($message, 'text/html') ; if ($file_name) { $message->attach(Swift_Attachment::fromPath($file_path)); } $result = $mailer->send($message); In this case $filepath is the tmp path which I am using when a user attaches a files from a form and $file_name is the tmp file name $_FILES[

Swiftmailer 4 does not retrieve bounces as $failedRecipients

社会主义新天地 提交于 2019-11-30 09:36:00
问题 I am trying this code (from http://swiftmailer.org/docs/sending.html): require_once 'lib/swift_required.php'; //Create the Transport $transport = Swift_SmtpTransport::newInstance('localhost', 25); //Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); //Create a message $message = Swift_Message::newInstance('Wonderful Subject') ->setFrom(array('john@doe.com' => 'John Doe')) ->setBody('Here is the message itself') ; //Send the message

swiftmailer and email form with attachment - beginner

末鹿安然 提交于 2019-11-30 08:43:02
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 would send it to peoples out rather than uploading the file. // Create the Transport $transport = Swift

How to close Smtp connection in SwiftMailer

老子叫甜甜 提交于 2019-11-30 08:38:00
I use SwiftMailer to send emails from a gearman worker process. I'm using the Swift_SmtpTransport class to send emails. The problem is that if this worker process stays idle for sometime, the SwiftMailer smtp connection times out. Now when the next job arrives, SwiftMailer fails to send emails as the connection has been timed out. Ideally, I would want to close the smtp connection after every job. I'm unable to locate a api in the class which does this specifically. Neither does unset() object works since this is a static class. cernio There is a rude option: stop the transport explicitly. On

Unable to send e-mail from within custom Symfony2 command but can from elsewhere in app

浪子不回头ぞ 提交于 2019-11-30 07:27:58
I have written a custom console command to query my database, produce a report and e-mail it to an address; however I can not seem to successfully send the e-mail. I can send e-mail fine from within normal controllers elsewhere within my application, and I can also send it from within my console command if I manually create and configure a Swift_Mailer instance and not get it via the container. Here is a stripped down version of my console command: <?php namespace Foo\ReportBundle\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input

Swift Mailer Delivery Status

故事扮演 提交于 2019-11-30 06:29:54
问题 Does anyone know if SwiftMailer send function returns delivery status? I would like to be able to know that email was delivered or not delivered.Is this possible? Thanks 回答1: There are at least three layers of checks that SwiftMailer supports, that will report several types of delivery failures. 1) Always check the return code from SwiftMailer's send() or batchSend() commands for a non-zero result. From the documentation: //Send the message $numSent = $mailer->send($message); printf("Sent %d

Bypass Gmail's spam filter (mails sent with PHP from a shared host)

狂风中的少年 提交于 2019-11-30 06:29:00
问题 TL;DR: Mails sent from shared hosting (such as a cheap domain from Unoeuro or One.com) end up in spam. How to fix? I made a mail-system, that first generated a PDF-file (using FPDF), whereafter it sent the PDF-file as an attachment with PHP's Swiftmailer. This email was sent out to 130 people (as a 'one-of' invoice). But it landed in the spam-filter for almost everybody. I tried adjusting SwiftMailers header-settings, but without any luck. Even mails that I haven't sent to before (thoroughly