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. No Image 24Sep
    by JAESOO
    2016/09/24 by JAESOO
    Views 375 

    Reverse DNS - 등록및 확인

  2. No Image 01Jul
    by JAESOO
    2016/07/01 by JAESOO
    Views 405 

    파일질라(filezilla) 디렉터리 목록 조회 실패

  3. No Image 20Jun
    by JAESOO
    2015/06/20 by JAESOO
    Views 585 

    시만텍(Symantec) 솔루션 적용 구성도

  4. No Image 17Apr
    by JAESOO
    2015/04/17 by JAESOO
    Views 416 

    [기술자료] 전용선

  5. No Image 17Apr
    by JAESOO
    2015/04/17 by JAESOO
    Views 350 

    전용회선의 종류

  6. No Image 16Apr
    by JAESOO
    2015/04/16 by JAESOO
    Views 883 

    [이도경 칼럼] 올해 인터넷전화 도입시 주의사항 10가지 2

  7. No Image 16Apr
    by JAESOO
    2015/04/16 by JAESOO
    Views 423 

    [이도경 칼럼] 올해 인터넷전화 도입시 주의사항 10가지 1

  8. No Image 21Jan
    by JAESOO
    2015/01/21 by JAESOO
    Views 739 

    How to Set a Passive Port Range in Serv-U FTP Server - KB Article #2100

  9. No Image 27Jun
    by JAESOO
    2014/06/27 by JAESOO
    Views 1507 

    초고속 정보통신 건물 앰블럼 시험항목

  10. No Image 27Jun
    by JAESOO
    2014/06/27 by JAESOO
    Views 1798 

    Digital 통신용 UTP 케이블의 종류와 특성

  11. No Image 27Jun
    by JAESOO
    2014/06/27 by JAESOO
    Views 1891 

    디지털 통신용 UTP Cable의 종류와 특성 이해

  12. No Image 27Jun
    by JAESOO
    2014/06/27 by JAESOO
    Views 17909 

    통신 네트워크 관련용어정리 (기본 통신네트워크, 데이터통신 네트워크, 영상통신 네트워크)

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

  14. No Image 19Dec
    by JaeSoo
    2013/12/19 by JaeSoo
    Views 2561 

    일반형 항온항습기와 일체형 항온항습기 비교

  15. No Image 27Nov
    by JaeSoo
    2013/11/27 by JaeSoo
    Views 4325 

    IP 대역 계산

  16. No Image 24Oct
    by JaeSoo
    2013/10/24 by JaeSoo
    Views 2959 

    회선비, 상면비

  17. No Image 24Oct
    by JaeSoo
    2013/10/24 by JaeSoo
    Views 2114 

    코로케이션(Co-location)이란?

  18. No Image 24Oct
    by JaeSoo
    2013/10/24 by JaeSoo
    Views 2404 

    데이터 센터에 대한 일반 상식

  19. No Image 28Sep
    by JaeSoo
    2013/09/28 by JaeSoo
    Views 4636 

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

  20. No Image 11Sep
    by JaeSoo
    2013/09/11 by JaeSoo
    Views 5226 

    인터넷속도측정 10초면 가능 인터넷속도 체크해보세요

Board Pagination Prev 1 2 3 4 Next
/ 4

PageViews   Today : 317 Yesterday : 12383 Total : 21968752  /  Counter Status   Today : 310 Yesterday : 11957 Total : 1194990

Edited by JAESOO

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소