Questions tagged [swiftmailer]

Swift Mailer is a library that integrates into any web app written in PHP, offering a flexible and elegant object-oriented approach to sending emails with a multitude of features.

Swift Mailer is a library that facilitates sending email in PHP.

Benefits over the native mail() function include the use of , , or a custom transport layer, support for servers that require authentication, prevention of header injection attacks, support for attachments and more.


Documentation :

1670 questions
6
votes
2 answers

How to get Email Queue ID with swiftmailer?

When I send email using telnet smtp server answers me 250 2.0.0 Ok: queued as 7A821440123E when email was sent. So I need to get ID 7A821440123E to track email in mail log. Is it posible to get this with Swiftmailer?
Dmitro
  • 1,489
  • 4
  • 22
  • 40
6
votes
2 answers

Symfony2 styled emails best practices

What are the best practices to send emails from html & css? I have much mails in my projects & need the solution, that can allow me not to write all below code again & again: $msg = \Swift_Message::newInstance() ->setSubject('Test') …
Cybercarnage シ
  • 525
  • 7
  • 16
6
votes
1 answer

how to use swiftmailer handler with monolog

i would like to know how exactly to use SwiftMailerHandler within Monolog packagist? In the Monolog documentation i don't see any usage example regarding SwiftMailerHandler or maybe i missed out. Here is the SwiftMailerHandler constructor code: …
Firman Hidayat
  • 415
  • 4
  • 13
6
votes
3 answers

How to unlink files after they have been attached and sent? (When using Mail::queue)

I switched from sending my mails immediately to adding them to the queue, here is my code, the $attachments is an array of temporary paths, I've commented out what I've tried, which throws errors about files not existing. Mail::queue($view, $data,…
Moak
  • 12,596
  • 27
  • 111
  • 166
6
votes
2 answers

Sending base64 emails with SWIFTMAIL

I am just trying to get my multipart emails encoded with base64 and send via swiftmail. Here is the code I have so far: $message = Swift_Message::newInstance("Email Template Test") ->setBoundary($boundary) …
Chud37
  • 4,907
  • 13
  • 64
  • 116
6
votes
2 answers

How to attach images in swiftmailer to embed them in twig mail template?

I want to use images in my mail template - they should be sent with the mail. How do I embed them in twig template (a special path or setting to address them?)? Do I attach them as an attachment or are there some special settings?
jeff
  • 1,169
  • 1
  • 19
  • 44
6
votes
2 answers

Symfony2 Monolog to Email Errors why swiftmailer.transport.real is non-existent service

after updating symfony from 2.3 to 2.4 i got ServiceNotFoundException Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException' with message 'The service "monolog.handler.mojhandler" has a dependency…
vardius
  • 6,326
  • 8
  • 52
  • 97
6
votes
2 answers

Send mail through smtp.gmail.com in symfony 2 using swiftmailer

I am having a trouble of sending mail from xampp localhost using gmail. And after a long time I finally successful on it. And I am sharing it with all you. If I am wrong need proper solution for it. in config.yml of your symfony 2 Write…
Al- Imran Khan
  • 187
  • 1
  • 5
  • 14
6
votes
2 answers

Swift mailer triggers fatal error;

Fatal error: Uncaught exception 'Swift_TransportException' with message 'Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first. fb9sm57232081wid.2 - gsmtp "' in …
Sophie Mackeral
  • 897
  • 4
  • 12
  • 21
6
votes
1 answer

Batch Send Email with SwiftMailer

I'm currently using SwiftMailer to send out emails to several users (up to 50). I have it set up and working properly, however, I'm not quite sure how to pull the recipients from my MySQL database and iterate to send them. Here is what I currently…
Dodinas
  • 6,705
  • 22
  • 76
  • 108
6
votes
2 answers

YAML setting value from another key

How can I set a value in YAML from another key e.g: example.emails: - ben@example.co - neb@example.co - teb@example.co swift: to_email: example.emails
Ben_hawk
  • 2,476
  • 7
  • 34
  • 59
6
votes
2 answers

Multiple instances of Swiftmailer in Symfony2

Symfony2 uses a Swiftmailer bundle to send emails. To use and configure Swiftmailer in Symfony2, one has to use such a configuration as explained in the docs, e.g. by using YAML: swiftmailer: transport: smtp encryption: ssl auth_mode: …
JeanValjean
  • 17,172
  • 23
  • 113
  • 157
6
votes
3 answers

Sending emails asynchronously: spool, queue, and cronjob/daemon

I want to send emails asynchronously for faster and lighter http responses, but I'm struggling with many new concepts. For example, the documentation talks about spool. It says I should use spool with a file, and then send emails with a command. But…
ChocoDeveloper
  • 14,160
  • 26
  • 79
  • 117
6
votes
1 answer

Swiftmailer//Twig email not rendering correctly

I'm experimenting with symfony2 framework and i'm trying to send emails using swiftmailer and twig. The problem is, with my current implementation, the email is sent in html (you can see the tags, everything). Here is the controller i'm using: …
Cláudio Ribeiro
  • 1,509
  • 3
  • 37
  • 65
5
votes
2 answers

Swiftmailer mails go into SPAM Folder

$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' =>…
user434509
  • 425
  • 8
  • 20