php-swiftmailerHow to send emails without encryption in SwiftMailer?
SwiftMailer can be used to send emails without encryption. To do this, you need to create a Swift_Message
object and set the setEncryption
method to null
.
$message = new Swift_Message();
$message->setEncryption(null);
The code above will create a Swift_Message
object and set the encryption to null
.
To send the email, you need to create a Swift_Mailer
object and call the send()
method with the Swift_Message
object as an argument.
$mailer = new Swift_Mailer();
$mailer->send($message);
The code above will create a Swift_Mailer
object and send the email with the Swift_Message
object.
Code explanation
Swift_Message
: This is an object used to create an email message.setEncryption()
: This is a method used to set the encryption for the email message.Swift_Mailer
: This is an object used to send the email message.send()
: This is a method used to send the email message.
Helpful links
More of Php Swiftmailer
- How to use TLS 1.2 with Swiftmailer?
- How to configure Swiftmailer for SMTP without authentication?
- How to use SMTP with Swiftmailer?
- Swiftmailer usage example
- How to set timeout with Swiftmailer?
- How to check Swiftmailer version?
- How to get the response code when using Swiftmailer?
- How to use Swiftmailer with Symfony?
- How to send emails to multiple recipients with Swiftmailer?
- How to use Swiftmailer to send RFC 2822 compliant emails?
See more codes...