$mail = new PHPMailer(); $mail->setFrom('sender@example.com', 'Sender Name');
$mail = new PHPMailer(); $mail->setFrom('sender@example.com');In this example, the setFrom function is used to set the email address of the sender to "sender@example.com". Since no name argument is provided, the sender name will default to the email address. The PHPMailer library is an open-source library available on GitHub.