smtp_start()


设定并准备向SMTP发送邮件需要的项目

Description

void smtp_start(string $rcpt_email, string $rcpt_name, string $subject, string $body)

Parameters

Return Value

none

Example

<?php
include_once "/lib/sn_dns.php";    // including DNS library
include_once "/lib/sn_smtp.php";   // including SMTP library
smtp_hostname("from_domain.com");  // sender's host name
// sender's email address and name
smtp_account("from_id@from_domain.com", "from_name");
$subject = "email test from PHPoC";
$message = "Hi PHPoC\r\nThis is PHPoC test email\r\nGood bye\r\n";
// preparing to send
smtp_start("to_id@to_domain.com", "to_name", $subject, $message);
while(1)
{
  $msg = smtp_loop(); 
  if($msg === false)
    usleep(1000);
  elseif($msg == "")
    ;
  else
    echo "$msg\r\n";
}
?>

See also