RadarURL
Skip to content
조회 수 3938 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
출처: http://www.linuxquestions.org/questions/showthread.php?t=359033
        http://pear.php.net/package/Mail
아래 소스는
http://www.linuxquestions.org/questions/showthread.php?t=359033
에서 가져 왔고
Mail_smtp 클래스는
http://pear.php.net/package/Mail
에서 받으시면 됩니다.

<?php

include('Mail/smtp.php');

class MailHandler{
var $params = null;
var $mail_object = null;
var $recipients = null;
var $headers = null;
var $body = "";

function MailHandler($host, $port, $auth, $username, $password, $persist) {
$this->params["host"] = $host;
$this->params["port"] = $port;
$this->params["auth"] = $auth;
$this->params["username"] = $username;
$this->params["password"] = $password;
$this->params["persist"] = $persist;

// Create the mail object using the Mail::factory method
//$this->mail_object =& Mail::factory('smtp', $this->params);
$this->mail_object = new Mail_smtp($this->params);
}

function createFrom($email){
$this->headers['From'] = $email;
}

function createTo($email){
$this->headers['To'] = $email;
$this->recipients = array($email);
}

function createCC($email){
$this->headers['Cc'] = $email;
}

function createBCC($email){
$this->headers['Bcc'] = $email;
}

function createSubject($sub){
$this->headers['Subject'] = $sub;
}

function createBody($body){
$this->body=$body;
}

function sendMail(){
if ($this->mail_object->send($this->recipients, $this->headers, $this->body)) {
return true;
}
else{
return false;
}
}
}


$smtpserver_host = "localhost"; // The server to connect. Default is localhost
$smtpserver_Port = 25; // The port to connect. Default is 25
$smtpserver_auth = FALSE; // Whether or not to use SMTP authentication. Default is FALSE
$smtpserver_username = "username"; // The username to use for SMTP authentication.
$smtpserver_password = "password"; // The password to use for SMTP authentication.
$smtpserver_persist = FALSE; // Indicates whether or not the SMTP connection should persist over multiple calls to the send() method.
$mailhandler=new MailHandler($smtpserver_host, $smtpserver_Port, $smtpserver_auth, $smtpserver_username, $smtpserver_password, $smtpserver_persist);

$mailhandler->createTo("toaddress");
$mailhandler->createFrom("fromaddress");
$mailhandler->createSubject("subject");
$mailhandler->createBody("body");

if($mailhandler->sendMail()){
echo "Mail sent.n";
}
else{
echo "Error sending mail!n";
}

?>

출처 : http://www.sir.co.kr/bbs/board.php?bo_table=pl_php&wr_id=333&page=4
?

  1. Reverse DNS - 등록및 확인

    Date2016.09.24 ByJAESOO Views375
    Read More
  2. 파일질라(filezilla) 디렉터리 목록 조회 실패

    Date2016.07.01 ByJAESOO Views400
    Read More
  3. 시만텍(Symantec) 솔루션 적용 구성도

    Date2015.06.20 ByJAESOO Views585
    Read More
  4. [기술자료] 전용선

    Date2015.04.17 ByJAESOO Views416
    Read More
  5. 전용회선의 종류

    Date2015.04.17 ByJAESOO Views350
    Read More
  6. [이도경 칼럼] 올해 인터넷전화 도입시 주의사항 10가지 2

    Date2015.04.16 ByJAESOO Views883
    Read More
  7. [이도경 칼럼] 올해 인터넷전화 도입시 주의사항 10가지 1

    Date2015.04.16 ByJAESOO Views423
    Read More
  8. How to Set a Passive Port Range in Serv-U FTP Server - KB Article #2100

    Date2015.01.21 ByJAESOO Views739
    Read More
  9. 초고속 정보통신 건물 앰블럼 시험항목

    Date2014.06.27 ByJAESOO Views1507
    Read More
  10. Digital 통신용 UTP 케이블의 종류와 특성

    Date2014.06.27 ByJAESOO Views1798
    Read More
  11. 디지털 통신용 UTP Cable의 종류와 특성 이해

    Date2014.06.27 ByJAESOO Views1891
    Read More
  12. 통신 네트워크 관련용어정리 (기본 통신네트워크, 데이터통신 네트워크, 영상통신 네트워크)

    Date2014.06.27 ByJAESOO Views17909
    Read More
  13. 전기 연선의 굵기(SQ), 가닥(C), 단위 읽는 방법과 해석

    Date2013.12.20 ByJaeSoo Views6891
    Read More
  14. 일반형 항온항습기와 일체형 항온항습기 비교

    Date2013.12.19 ByJaeSoo Views2558
    Read More
  15. IP 대역 계산

    Date2013.11.27 ByJaeSoo Views4325
    Read More
  16. 회선비, 상면비

    Date2013.10.24 ByJaeSoo Views2959
    Read More
  17. 코로케이션(Co-location)이란?

    Date2013.10.24 ByJaeSoo Views2114
    Read More
  18. 데이터 센터에 대한 일반 상식

    Date2013.10.24 ByJaeSoo Views2404
    Read More
  19. 텐센트 10TB 무료 대용량 클라우드 서비스 모바일 APP/PC 클라이언트 한글화 배포(PC버전 추가)

    Date2013.09.28 ByJaeSoo Views4636
    Read More
  20. 인터넷속도측정 10초면 가능 인터넷속도 체크해보세요

    Date2013.09.11 ByJaeSoo Views5226
    Read More
Board Pagination Prev 1 2 3 4 Next
/ 4

PageViews   Today : 12126 Yesterday : 5037 Total : 21968178  /  Counter Status   Today : 11733 Yesterday : 4602 Total : 1194456

Edited by JAESOO

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소