在wordpress中有没有更清晰的PHPmailer代码..?

As a extended version to this question : PHPMailer(): Called Mail() without being connected

Can't we use all the configurations for the PHPmailer in an array, Some thing like this:

$mail = array(
        'SMTPAuth'  => true,
        'Host'      => 'smtp.millicenthotel.com',
        'Port'      => 25,
        'Username'  => 'info@millicenthotel.com',
        'Password'  => 'gboskeritysoldier1'
        );

I tried something like this and it not work. I'm looking for a cleaner way of doing this.

Thanks in Advance.

you have an action hook called phpmailer_init

from codex :

The wp_mail function relies on the PHPMailer class to send email through PHP's mail function. The phpmailer_init action hook allows you to hook to the phpmailer object and pass in your own arguments.

example ( codex again ):

add_action( 'phpmailer_init', 'my_phpmailer_example' );

function my_phpmailer_example( $phpmailer ) {
    $phpmailer->IsSMTP();     //switch to smtp
    $phpmailer->Host = 'smtp.example.com';
    $phpmailer->Port = 25;
    $phpmailer->Username = 'yourusername';
    $phpmailer->Password = 'yourpassword';
}