esmtp_send()


ESMTP로 메일을 전송

Description

string esmtp_send(string $rcpt_email, string $rcpt_name, string $subject, string $body)

Parameters

Return Value

없음

Example

<?php
include_once "/lib/sn_dns.php";  // DNS 라이브러리 추가
include_once "/lib/sn_esmtp.php";   // ESMTP 라이브러리 추가
esmtp_hostname("from_domain.com");    // 송신자 호스트 이름 설정
esmtp_account("from_id@from_domain.com", "from_name");   // 송신자 이메일 및 이름 설정
esmtp_auth("msa_id", "msa_password");   // 보내는 메일서버 계정의 아이디와 비밀번호 설정
esmtp_msa("smtp.msa_domain", 465);   // 보내는 메일서버와 포트 번호 설정
$subject = "msa test";
$message = "Hi PHPoC\r\nThis is PHPoC msa test email\r\nGood bye\r\n";
$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";
?>

See also