1Introduction 2============ 3 4Swift Mailer is a component based library for sending e-mails from PHP applications. 5 6System Requirements 7------------------- 8 9Swift Mailer requires PHP 7.0 or higher (``proc_*`` functions must be 10available). 11 12Swift Mailer does not work when used with function overloading as implemented 13by ``mbstring`` when ``mbstring.func_overload`` is set to ``2``. 14 15Installation 16------------ 17 18The recommended way to install Swiftmailer is via Composer: 19 20.. code-block:: bash 21 22 $ composer require "swiftmailer/swiftmailer:^6.0" 23 24Basic Usage 25----------- 26 27Here is the simplest way to send emails with Swift Mailer:: 28 29 require_once '/path/to/vendor/autoload.php'; 30 31 // Create the Transport 32 $transport = (new Swift_SmtpTransport('smtp.example.org', 25)) 33 ->setUsername('your username') 34 ->setPassword('your password') 35 ; 36 37 // Create the Mailer using your created Transport 38 $mailer = new Swift_Mailer($transport); 39 40 // Create a message 41 $message = (new Swift_Message('Wonderful Subject')) 42 ->setFrom(['john@doe.com' => 'John Doe']) 43 ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name']) 44 ->setBody('Here is the message itself') 45 ; 46 47 // Send the message 48 $result = $mailer->send($message); 49 50You can also use Sendmail as a transport:: 51 52 // Sendmail 53 $transport = new Swift_SendmailTransport('/usr/sbin/sendmail -bs'); 54 55Getting Help 56------------ 57 58For general support, use `Stack Overflow <https://stackoverflow.com>`_. 59 60For bug reports and feature requests, create a new ticket in `GitHub 61<https://github.com/swiftmailer/swiftmailer/issues>`_. 62