Are there any best practices for initializing Zend_Mail in PHP projects?

When initializing Zend_Mail in PHP projects, it is a best practice to set the transport method and sender information before sending any emails. This ensures that the email is sent successfully and with the correct sender information.

// Initialize Zend_Mail
$mail = new Zend_Mail();

// Set the transport method (in this case, using SMTP)
$transport = new Zend_Mail_Transport_Smtp('smtp.example.com', array(
    'auth' => 'login',
    'username' => 'username',
    'password' => 'password'
));
$mail->setDefaultTransport($transport);

// Set the sender information
$mail->setFrom('sender@example.com', 'Sender Name');

// Add recipient, subject, and body
$mail->addTo('recipient@example.com')
     ->setSubject('Subject of the email')
     ->setBodyText('Body of the email');

// Send the email
$mail->send();