MTA
[ class tree: MTA ] [ index: MTA ] [ all elements ]

Class: MTA

Source Location: /MTA/MTA.php

Class Overview

MTA_Socket
   |
   --MTA_Generate
      |
      --MTA

MTA 없이 메일을 발송하기 위한 API


Variables

Methods


Inherited Variables

Inherited Methods

Class: MTA_Generate

MTA_Generate::addr()
Check mail address and convert email format
MTA_Generate::attach()
Attach file의 template을 생성
MTA_Generate::boundary()
mail boundary 생성
MTA_Generate::check_domain()
Check domain of mail address 메일 주소의 도메인 섹션의 유효성을 검증한다.
MTA_Generate::check_local()
메일 주소의 local 섹션의 유효성을 검증한다.
MTA_Generate::date()
메일 헤더에서 사용할 시간 형식 반환
MTA_Generate::encode()
메시지 인코딩
MTA_Generate::error()
에러 발생시에, 에러 메시지를 myException으로 전달한다.
MTA_Generate::mime()
파일 확장자에 대한 mime type을 반환
MTA_Generate::msgid()
Message ID 생성

Class: MTA_Socket

MTA_Socket::close()
Quit 명령을 실행한 후, socket을 닫는다.
MTA_Socket::data()
DATA 명령 전송 및 mail body 전송
MTA_Socket::debug()
verbose properity가 true로 설정이 되면 debug 메시지를 출력한다.
MTA_Socket::ehlo()
ehlo 명령 전송
MTA_Socket::mailfrom()
mailfrom 명령 전송
MTA_Socket::open()
MTA_Socket::rcptto()
RCPT 명령 전송
MTA_Socket::read()
소켓을 읽는다.
MTA_Socket::socket_send()
메일 발송
MTA_Socket::target_object()
동일한 호스트에 여러번 접속하지 않도록 하기 위하여 메일 호스트 별로 모음
MTA_Socket::write()
데이터의 끝에 "\r\n"을 붙여서 전송한다.

Class Details

[line 48]
MTA 없이 메일을 발송하기 위한 API

예제:

  1. <?php
  2. /*
  3.  * Test code for MTA
  4.  * $Id$
  5.  */
  6.  
  7. $iniget function_exists ('___ini_get''___ini_get' 'ini_get';
  8. $iniset function_exists ('___ini_set''___ini_set' 'ini_set';
  9.  
  10. $cwd getcwd ();
  11. $ccwd basename ($cwd);
  12. if $ccwd == 'tests' {
  13.     $oldpath $iniget ('include_path');
  14.     $newpath preg_replace ("!/{$ccwd}!"''$cwd);
  15.     $iniset ('include_path'$newpath ':' $oldpath);
  16. }
  17.  
  18. require_once 'MTA.php';
  19.  
  20.  
  21. try {
  22.     $o = (object) array (
  23.         'from' => 'Sender <sender@domain.com>',
  24.         'to'   => array (
  25.             'Receiver1 <user1@domain1.com>',
  26.             'Receiver2 <user1@domain2.com>',
  27.             'Receiver3 <user2@domain1.com>',
  28.             'Receiver4 <user2@domain2.com>',
  29.         ),
  30.         'cc'   => 'CC User1 <ccuser@domain1.com>',
  31.         'subject' => '보내보아요....',
  32.         'body' => 'ㅎㅎㅎ <b>잘</b> 받아 보아요...',
  33.         'attach' => array (
  34.             '/usr/share/lighttpd/flags/kr.png',
  35.             '/usr/share/lighttpd/flags/jp.png'
  36.         )
  37.     );
  38.  
  39.     $mta new MTA ();
  40.  
  41.     echo ' ** test MTA::source method' "\n\n";
  42.  
  43.     $template $mta->source ($o);
  44.     echo preg_replace ('/^/m''    '$template);
  45.  
  46.     echo "\n";
  47.     echo ' ** test MTA::send method' "\n\n";
  48.     $mta->verbose true;
  49.     $buf print_r ($mta->send ($o)true);
  50.  
  51.     echo preg_replace ('/^/m''    '$buf);
  52.     echo "\n";
  53.  
  54. catch myException $e {
  55.     fprintf (STDERR"%s\n"$e->Message ());
  56.     #print_r ($e);
  57.     #print_r ($e->Trace ());
  58.     #echo $e->TraceAsString () . "\n";
  59.     print_r ($e->TraceAsArray ()) "\n";
  60.     $e->finalize ();
  61. }
  62.  
  63. /*
  64.  * Local variables:
  65.  * tab-width: 4
  66.  * c-basic-offset: 4
  67.  * End:
  68.  * vim: set filetype=php noet sw=4 ts=4 fdm=marker:
  69.  * vim600: noet sw=4 ts=4 fdm=marker
  70.  * vim<600: noet sw=4 ts=4
  71.  */
  72. ?>




[ Top ]


Class Variables

$charset =  'utf-8'

[line 57]

입력한 문자셋



Tags:

access:  public

Type:   string


[ Top ]

$magent =  'oops\MTA'

[line 67]

Mail agent 값. 기본값은 oops\MTA 이다.



Tags:

access:  public

Type:   string


[ Top ]

$sock =  null

[line 74]

내부적으로 사용할 socket descriptor



Tags:

access:  protected

Type:   resource


[ Top ]

$verbose =  false

[line 62]

send method 실행시 debug message 출력



Tags:

access:  public

Type:   boolean


[ Top ]



Class Methods


constructor __construct [line 81]

MTA __construct( )

MTA class 초기화



[ Top ]

method send [line 122]

stdClass send( stdClass $o)

메일 발송

예제:

  1.     $o = (object) array (
  2.         'from' => 'Sender <sender@domain.com>',
  3.         'to'   => array (
  4.             'Receiver1 <user1@domain1.com>',
  5.             'Receiver2 <user1@domain2.com>',
  6.             'Receiver3 <user2@domain1.com>',
  7.             'Receiver4 <user2@domain2.com>',
  8.         ),
  9.         'cc'   => 'CC User1 <ccuser@domain1.com>',
  10.         'subject' => '보내보아요....',
  11.         'body' => 'ㅎㅎㅎ <b>잘</b> 받아 보아요...',
  12.         'attach' => array (
  13.             '/usr/share/lighttpd/flags/kr.png',
  14.             '/usr/share/lighttpd/flags/jp.png'
  15.         )
  16.     );
  17.  
  18.     $mta new MTA ();
  19.  
  20.     echo ' ** test MTA::source method' "\n\n";
  21.  
  22.     $template $mta->source ($o);
  23.     echo preg_replace ('/^/m''    '$template);
  24.  
  25.     echo "\n";
  26.     echo ' ** test MTA::send method' "\n\n";
  27.     $mta->verbose true;
  28.     $buf print_r ($mta->send ($o)true);




Tags:

return:  

발송 결과를 object로 반환한다.

   stdClass Object
   (
       [status]  => (bool) 성공 실패 여부
       [error]   => (string) status false시 에러 메시지
       [rcptlog] => (array) rcpt to에 대한 log
   )

RCPT list별로 확인을 위해서 status가 true이더라도 rcptlog를 확인하는 것이 필요

access:  public


Parameters:

stdClass   $o   mail object
   stdClass Object
   (
       [rpath]  => (string) return path (optional)
       [from]   => (string) Sender address
       [to]     => (array) Reciever address
       [cc]     => (array) See also reciever address
       [bcc]    => (array) Hidden see also reciever address
       [subjet] => (string) mail subject
       [body]   => (string) mail contents
       [pbody]  => (string) planin/text mail contents (optional)
       [attach] => (array) attached files (optional)
   )

[ Top ]

method source [line 155]

string source( stdClass $v)

주어진 정보를 이용하여 raw mail body를 alternative/mixed 형식으로 반환

예제:

  1.     $o = (object) array (
  2.         'from' => 'Sender <sender@domain.com>',
  3.         'to'   => array (
  4.             'Receiver1 <user1@domain1.com>',
  5.             'Receiver2 <user1@domain2.com>',
  6.             'Receiver3 <user2@domain1.com>',
  7.             'Receiver4 <user2@domain2.com>',
  8.         ),
  9.         'cc'   => 'CC User1 <ccuser@domain1.com>',
  10.         'subject' => '보내보아요....',
  11.         'body' => 'ㅎㅎㅎ <b>잘</b> 받아 보아요...',
  12.         'attach' => array (
  13.             '/usr/share/lighttpd/flags/kr.png',
  14.             '/usr/share/lighttpd/flags/jp.png'
  15.         )
  16.     );
  17.  
  18.     $mta new MTA ();
  19.  
  20.     echo ' ** test MTA::source method' "\n\n";
  21.  
  22.     $template $mta->source ($o);




Tags:

return:  If occur error, throw excption
access:  public


Parameters:

stdClass   $v   mail object
   stdClass Object
   (
       [from]   => (string) Sender address
       [to]     => (array) Reciever address
       [cc]     => (array) See also reciever address (optional)
       [bcc]    => (array) Hidden see also reciever address (optional)
       [subjet] => (string) mail subject
       [body]   => (string) mail contents
       [pbody]  => (string) planin/text mail contents (optional)
       [attach] => (array) attached files (optional)
   )

[ Top ]


Documentation generated on Tue, 14 May 2019 02:00:33 +0900 by phpDocumentor 1.4.4