php-swiftmailerHow to use Swiftmailer's addPart() method?
The addPart() method of Swiftmailer is used to add a part to a message. It takes two parameters: the body of the message and the content type.
Example
$message->addPart('This is the body of the message', 'text/plain');
The code above will add a plain text part to the message.
Parts of the code:
$message: an instance of theSwift_MessageclassaddPart(): the method used to add a part to the message'This is the body of the message': the body of the message'text/plain': the content type of the message
Helpful links
More of Php Swiftmailer
- How to install Swiftmailer using Composer?
- How to configure Swiftmailer for SMTP without authentication?
- How to enable TLS with Swiftmailer?
- How to configure Swiftmailer for Postfix?
- How to access Swiftmailer logs?
- How to set the port for Swiftmailer?
- How to configure Swiftmailer logger?
- How to mock SwiftMailer?
- How to send HTML emails with Swiftmailer?
- How to use SMTP with Swiftmailer?
See more codes...