swiftmailer

Send emails via memory in controllers and spool in some commands in Symfony2

放肆的年华 提交于 2019-12-02 02:38:36
问题 I need to use the spool option to send massive emails to my users, but i won't to change whole config of my app to spool because my register system send an email to the user and i want that this email be instant send. Is any way to do this without change the global config for swiftmailer? 回答1: You can configure different emailers. For example: swiftmailer: default_mailer: spool_mailer mailers: spool_mailer: spool: type: file path: /path/to/spool # ... instant_mailer: # ... Then use one

Unable to send emails in Laravel using Swift Mailer - proc_open() function disabled by the provider

前提是你 提交于 2019-12-02 02:35:54
My web host disabled proc_open function in php and I can't send emails anymore. I get this error log: proc_open() has been disabled for security reasons I use laravel default Swiftmailer. What can I do? proc_open should only be required when Swiftmailer is using an external executable, like sendmail. You should still be able to use a different transport like SMTP, Mailgun, or one of the other drivers described in the docs. As a test, try using the SMTP driver, and just entering your own SMTP mail details - whatever you use to send mail from your mail client. Try the following in your .env :

Using swiftmailer and sending attachments

杀马特。学长 韩版系。学妹 提交于 2019-12-02 02:32:59
问题 I am trying to modify a script to send a email with an attachment. It works right now but all the fields are required and I was wondering what I am missing to make it so the fields are not required. <?php if (($_POST)) { $success = $error = false; $post = new stdClass; foreach ($_POST as $key => $val) $post->$key = trim(strip_tags($_POST[$key])); $dir = dirname(__FILE__); ob_start(); require_once($dir.'/html.php'); $html_message = ob_get_contents(); ob_end_clean(); require_once($dir.'/swift

Using swiftmailer and sending attachments

假装没事ソ 提交于 2019-12-02 02:19:56
I am trying to modify a script to send a email with an attachment. It works right now but all the fields are required and I was wondering what I am missing to make it so the fields are not required. <?php if (($_POST)) { $success = $error = false; $post = new stdClass; foreach ($_POST as $key => $val) $post->$key = trim(strip_tags($_POST[$key])); $dir = dirname(__FILE__); ob_start(); require_once($dir.'/html.php'); $html_message = ob_get_contents(); ob_end_clean(); require_once($dir.'/swift/swift_required.php'); $mailer = new Swift_Mailer(new Swift_MailTransport()); $message = Swift_Message:

Swiftmailer remove attachment after send

送分小仙女□ 提交于 2019-12-01 07:06:17
问题 I am trying to remove the attachment files after sending an email with Symfony 2.1 and Swiftmailer but if I delete the file before returning a response object (a redirect), the email does not send. I suppose this is because symfony sends the email in the response, so when the email has send the attachment has been removed already. For example: <?php // DefaultCotroller.php $message = \Swift_Message::newInstance($subject) ->setFrom('no-reply@dasi.es') ->setTo($emails_to) ->setBody($body, 'text

Retrieving a file name to attach to an email with SwiftMailer and PHP

旧时模样 提交于 2019-12-01 04:16:47
问题 I asked the question yesterday and got an advice, and used it, but it doesn't work for some reason. So, I need to retrieve the name of the file that was uploaded to my server from an HTML form by a user. I need this file to be attached to an email that is to be sent by PHP/SwiftMailer. Here is my code, the file upload portion: //File upload // Where the file is going to be placed $target_path = "uploads/"; // Add the original filename to our target path. //Result is "uploads/filename

MPDF E-mail Attachment Sends Blank PDF

别等时光非礼了梦想. 提交于 2019-12-01 01:13:46
I have successfully generated a PDF using mpdf, which I have verified by downloading the PDF. However, when I send the PDF as an e-mail attachment I receive a blank PDF with an "Out of Memory" error by Adobe Reader. Below is my code: <?php include("MPDF57/mpdf.php"); ob_start(); include "Receipt_Template_2.php"; $template = ob_get_contents(); ob_end_clean(); $mpdf=new mPDF('','A4','','',32,25,27,25,16,13,'L'); mpdf->WriteHTML($template); $content = $mpdf->Output($template, 'S'); $content = chunk_split(base64_encode($content)); $mailto = 'sample@sample.com'; $from_name = 'KIREA'; $from_mail =

Symfony 4 SwiftMailer Gmail : Email not sent

陌路散爱 提交于 2019-11-30 21:07:57
I'm currently working on a Symfony 4 application and I need to send emails throught Swift Mailer. When I send an email, I receive the email spooled but I don't get it in my Gmail Mailbox. I allowed unsecure apps in my gmail configuration. This is my mailer URL from .env file : MAILER_URL=gmail://ep****@gmail.com:PASSWORD@localhost This is my swiftmailer.yaml: #config/packages/swiftmailer.yaml swiftmailer: url: '%env(MAILER_URL)%' spool: { type: 'memory' } This is my controller function: src/Controller/AccountController.php This is the documentation I've followed : http://symfony.com/doc

Logging swiftmailer send() activity in symfony2

[亡魂溺海] 提交于 2019-11-30 17:39:28
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. 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 namespace App\Util; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; use Swift_Events_SendEvent; use Swift_Events

SwiftMailer + Gmail - Cannot send email

馋奶兔 提交于 2019-11-30 16:22:33
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); And then I get this: Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection