设定发送邮件host名称和端口号码
void esmtp_msa(string $msa_name, int $msa_port)
none
<?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 outgoing 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";
// Transmitting an email
$msg = esmtp_send("to_id@to_domain.com", "to_name", $subject, $message);
if($msg == "221")
echo "send mail successful\r\n";
else
echo "send mail failed\r\n";
?>