smtp_hostname()


设定发送SMTP邮件的host名称

Description

void smtp_hostname(string $hostname)

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");  // setting email sender's host name
// setting email 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";
// transmitting the email
$msg = smtp_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";
?>

See also