php-swiftmailerHow to set the sender name in SwiftMailer?
SwiftMailer allows you to set the sender name in the message header. To do this, you need to use the setFrom()
method.
$message->setFrom(['[email protected]' => 'John Doe']);
This will set the sender name to "John Doe" and the sender address to "[email protected]".
The setFrom()
method takes two parameters:
- The sender address - This is the email address of the sender.
- The sender name - This is the name of the sender that will be displayed in the message header.
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...