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
86
votes
13 answers

Laravel mail: pass string instead of view

I want to send a confirmation e-mail using laravel. The laravel Mail::send() function only seems to accept a path to a file on the system. The problem is that my mailtemplates are stored in the database and not in a file on the system. How can I…
nexana
  • 1,096
  • 1
  • 9
  • 18
81
votes
7 answers

Expected response code 220 but got code "", with message "" in Laravel

I am using Laravel Mail function to send email. The following is my app/config/mail.php file settings. 'driver' => 'sendmail', 'host' => 'smtp.gmail.com', 'port' => 587, 'from' => array('address' => 'email@gmail.com', 'name' =>…
dev90
  • 7,187
  • 15
  • 80
  • 153
65
votes
7 answers

PhpMailer vs. SwiftMailer?

I'm building a fairly simple PHP script that will need to send some emails with attachments. I've found these 2 libraries to do this. Does either one have significant advantages over the other? Or should I just pick one at random and be done with…
Paul Wicks
  • 62,960
  • 55
  • 119
  • 146
63
votes
10 answers

Failed to authenticate on SMTP server error using gmail

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' =>…
Diane Kaplan
  • 1,626
  • 3
  • 24
  • 34
53
votes
18 answers

Address in mailbox given [] does not comply with RFC 2822, 3.6.2. when email is in a variable

I have a correct email address. I have echoed it, but when I send it, I get the following error: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. Why? I use laravel (swift mailer) to send email: $email = email@address.com and…
user3077503
43
votes
2 answers

Adding line breaks to a text/plain email

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…
Chuck Le Butt
  • 47,570
  • 62
  • 203
  • 289
40
votes
6 answers

Using php's swiftmailer with gmail

I'm writing a simple script in which a gmail account is used to send an email to itself. I altered the script from SwiftMailer's reference, but I'm not getting any results. What's wrong? Edit: after further debugging I've found that the…
andandandand
  • 21,946
  • 60
  • 170
  • 271
40
votes
6 answers

How to use the swiftMailer in Yii2

I can't finally understand how to use the swiftMailer extension in Yii2. Judging by that on this subject I didn't find questions, the task is trivial, but up to the end I couldn't understand. There are examples which don't describe in more detail…
frops
  • 2,196
  • 4
  • 29
  • 42
33
votes
9 answers

trying to send mail using swift mailer, gmail smtp, php

Here is my code: setUsername('me@ff.com') ->setPassword('pass'); $mailer =…
champ
  • 807
  • 2
  • 11
  • 23
32
votes
2 answers

How to set reply-to when using Swiftmailer

How can reply-to be set when using Swiftmailer. The docs mentioned the function setReplyTo() but without specific instructions on how to use it. Any help will be appreciated.
Dave
  • 3,328
  • 7
  • 26
  • 30
30
votes
3 answers

Swift Mailer Delivery Status

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
DavidW
  • 5,069
  • 14
  • 46
  • 68
27
votes
14 answers

Swift_TransportException Connection could not be established with host smtp.gmail.com

I can't figure for the life of me why exactly is it failing.. this is the exact error I am getting: Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.gmail.com [Connection…
Andres
  • 2,013
  • 6
  • 42
  • 67
25
votes
13 answers

PHP Swift mailer: Failed to authenticate on SMTP using 2 possible authenticators

When I send an email with the PHP Swift mailer to this server: smtp.exchange.example.com like this: // Load transport $this->transport = Swift_SmtpTransport::newInstance( self::$config->hostname, self::$config->port ) …
VDVLeon
  • 1,393
  • 1
  • 15
  • 26
25
votes
17 answers

Using gmail smtp via Laravel: Connection could not be established with host smtp.gmail.com [Connection timed out #110]

When I try to use GMail SMTP for sending email via Laravel, I encounter the following error: Swift_TransportException Connection could not be established with host smtp.gmail.com [Connection timed out #110] It is the trace of the error: ... …
Ahmad
  • 8,811
  • 11
  • 76
  • 141
23
votes
1 answer

HTML vs Plain text as body in email

When creating a Swift_Message you can have both a plain text and an html version of the email. You set one as the body, and then you add the other one as a part. What is the difference if I set the HTML version as body and plain text as part, and…
Svish
  • 152,914
  • 173
  • 462
  • 620
1
2 3
99 100