phpmailerHow do I set the from name when using PHPMailer?
The From
name when using PHPMailer can be set using the setFrom
method. This method takes two parameters, the address and the name.
Example code
$mail->setFrom('[email protected]', 'Example Name');
The setFrom
method can also be used with an array containing the address and name.
Example code
$mail->setFrom(array('[email protected]' => 'Example Name'));
The From
name can also be set using the FromName
property.
Example code
$mail->FromName = 'Example Name';
The From
name can also be set using the addReplyTo
method. This method takes two parameters, the address and the name.
Example code
$mail->addReplyTo('[email protected]', 'Example Name');
The From
name can also be set using the Sender
property.
Example code
$mail->Sender = '[email protected]';
The From
name can also be set using the addCustomHeader
method. This method takes two parameters, the header name and the header value.
Example code
$mail->addCustomHeader('From', 'Example Name <[email protected]>');
Helpful links
More of Phpmailer
- How can I configure PHPMailer to work with GoDaddy?
- How can I use PHPMailer without SMTP secure?
- How can I configure PHPMailer to support Polish characters?
- How do I configure the timeout settings for PHPMailer?
- How can I use PHPMailer in Yii 1?
- How can I send emails using PHPMailer without using SMTP?
- How do I use PHPMailer to attach a ZIP file?
- How do I use PHPMailer with OAuth 2.0?
- How can I use PHPMailer to send emails with a Yahoo account?
- How do I use PHPMailer with OAuth2 authentication for Microsoft accounts?
See more codes...