Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11To send email with Swift Mailer, configure a transport, create a mailer and message, then call send(). The library is no longer maintained: Swift’s project recommends Symfony Mailer for new projects, so use the Swift example below to understand or maintain existing code and plan a migration for new development.
Send an email with Swift Mailer
Install the library with Composer, load its autoloader, and provide the SMTP server details for your mail provider. The basic sequence is Transport → Mailer → Message → send().
composer require "swiftmailer/swiftmailer:^6.0"
<?php
require_once '/path/to/vendor/autoload.php';
$transport = (new Swift_SmtpTransport('smtp.example.org', 25))
->setUsername('your username')
->setPassword('your password');
$mailer = new Swift_Mailer($transport);
$message = (new Swift_Message('Wonderful Subject'))
->setFrom(['john@doe.com' => 'John Doe'])
->setTo(['receiver@domain.org'])
->setBody('Here is the message itself');
$result = $mailer->send($message);
Replace the example host, port, credentials, sender, recipient and message with values for your environment. Swift Mailer establishes the transport connection on the first call to send(), rather than when the transport object is created. Its sending guide documents SMTP authentication and ssl or tls encryption; configure these according to your provider’s connection requirements.
Check the send result
send() returns an integer: the number of recipients accepted for sending. A return value of zero means none were accepted. Acceptance is not confirmation that a message reached a recipient’s inbox; the result does not establish final delivery.
#1 Best Overall
Choose a transport for the environment
Swift Mailer offers SMTP and Sendmail transports, as well as load-balanced and failover transport options. The appropriate choice depends on what your hosting environment and mail service provide.
| Transport | Deployment dependency | Authentication and encryption | Feedback | Portability and operational considerations |
|---|---|---|---|---|
| SMTP | A reachable remote SMTP server and its host and port | Swift Mailer supports authentication and ssl or tls; provider configuration determines the required settings. |
The official guide describes SMTP as providing useful feedback; send() reports accepted recipients, not confirmed inbox delivery. |
The official guide describes SMTP as portable. Keep credentials and server settings aligned with the selected provider. |
| Sendmail | A local Sendmail executable | Depends on the local mail setup; the guide does not establish SMTP-style authentication or encryption settings for this transport. | The official guide says feedback is generally less accurate than with SMTP. | Requires the local executable and configuration, which can make deployment dependent on the host environment. |
| Provider API | A third-party provider and its API integration | Depends on the provider transport; the cited Swift guide does not specify a universal authentication or encryption setup. | Feedback details vary by provider and are not stated as a universal Swift Mailer behavior. | Provider transports are available in Symfony Mailer, but the Swift guide does not establish a general API transport comparison for Swift Mailer. |
For a Swift Mailer SMTP setup, start with the provider’s exact SMTP hostname and port, then apply its required credentials and encryption settings. Don’t assume that a successful call means the email was delivered to the inbox.
Rank #2
Use Symfony Mailer for new projects
Swift Mailer’s project page says the library stopped being maintained at the end of November 2021 and recommends Symfony Mailer as its next evolution. The project documentation lists PHP 7.0 through PHP 8.1 as Swift Mailer’s compatibility range; because the library is unmaintained, that range is historical information, not a current compatibility recommendation. The official Swift Mailer project page and sending documentation both direct users toward Symfony Mailer.
Symfony Mailer’s current documentation describes installation with symfony/mailer, DSN-based configuration, and SMTP, sendmail, native and third-party provider transports. A typical SMTP DSN has this form:
Free tools Windows power users keep installed
One-click scans. No signup required.
smtp://user:pass@smtp.example.com:port
Use the host, port and credentials issued by your mail service. Reserved characters in a username, password or hostname must be encoded so they are interpreted correctly within the DSN. Symfony also supports provider transports, which can be relevant when moving from direct SMTP to a transactional email service.
For an existing application, Swift Mailer’s transport → mailer → message pattern can help identify where its setup and sending calls live. Migration still requires adapting the project to Symfony Mailer’s installation and configuration model; the available documentation does not establish a one-command or drop-in conversion.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

