正如@alfasin 所指出的,您需要遵循他提供给WinHost 知识库的第一个链接上的示例代码:
您需要将主机和用户名替换为您已设置的实际电子邮件帐户的详细信息。
<?php
require_once "Mail.php";
$from = "Sender <postmaster@HostingAccountDomain.com>";
$to = "Recipient <user@HostingAccountDomain.com>";
$subject = "This is a test email sent via php";
$body = "This is a test email";
$host = "mail.HostingAccountDomain.com";
$username = "postmaster@HostingAccountDomain.com";
$password = "email_password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password)
);
$mail = $smtp->send($to, $headers, $body);
?>