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_Message
classaddPart()
: 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 set timeout with Swiftmailer?
- How to use SMTP with Swiftmailer?
- How to use TLS 1.2 with Swiftmailer?
- How to get the response code when using Swiftmailer?
- How to use Swiftmailer to send RFC 2822 compliant emails?
- How to configure Swiftmailer for Postfix?
- How to send emails in UTF8 using Swiftmailer?
- How to send emails to multiple recipients with Swiftmailer?
- How to set the port for Swiftmailer?
- How to enable TLS with Swiftmailer?
See more codes...