接收邮件服务器的应答进行ESMTP邮件传送过程
false/string esmtp_loop(void)
none
成功时服务器的应答信息,失败时空字符串(“”)或是没有接到应答时false
<?php
include_once "/lib/sn_dns.php"; // including DNS library
include_once "/lib/sn_esmtp.php"; // including ESMTP library
esmtp_hostname("from_domain.com"); // setting email sender's host name
// setting email sender's email address and name
esmtp_account("from_id@from_domain.com", "from_name");
esmtp_auth("msa_id", "msa_password"); // setting email account and password of the email server
esmtp_msa("smtp.msa_domain", 465); // setting email server host name and port number
$subject = "msa test";
$message = "Hi PHPoC\r\nThis is PHPoC msa test email\r\nGood bye\r\n";
// preparing to send
esmtp_start("to_id@to_domain.com", "to_name", $subject, $message);
while(1)
{
$msg = esmtp_loop();
if($msg === false)
usleep(1000);
elseif($msg == "")
;
else
echo "$msg\r\n";
}
?>