PHP 클래스 ezcMail

You can use ezcMail together with the other classes derived from ezcMailPart to build email messages. When the mail is built, use the Transport classes to send the mail. This example builds and sends a simple text mail message: $mail = new ezcMail; $mail->from = new ezcMailAddress( '[email protected]', 'Adrian Ripburger' ); $mail->addTo( new ezcMailAddress( '[email protected]', 'Maureen Corley' ) ); $mail->subject = "Hi"; $mail->body = new ezcMailText( "I just mail to say I love you!" ); $transport = new ezcMailMtaTransport(); $transport->send( $mail ); By default, the ezcMail class will generate a mail with the Bcc header inside, and leave it to the SMTP server to strip the Bcc header. This can pose a problem with some SMTP servers which do not strip the Bcc header (issue #16154: Bcc headers are not stripped when using SMTP). Use the option stripBccHeader from {@link ezcMailOptions} to delete the Bcc header from the mail before it is sent. Example: $options = new ezcMailOptions(); $options->stripBccHeader = true; // default value is false $mail = new ezcMail( $options ); You can also derive your own mail classes from this class if you have special requirements. An example of this is the ezcMailComposer class which is a convenience class to send simple mail structures and HTML mail. There are several headers you can set on the mail object to achieve various effects: - Reply-To - Set this to an email address if you want people to reply to an address other than the from address. - Errors-To - If the mail can not be delivered the error message will be sent to this address.
상속: extends ezcMailPart
파일 보기 프로젝트 열기: zetacomponents/mail 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$options ezcMailOptions Holds the options for this class.

공개 메소드들

메소드 설명
__construct ( ezcMailOptions $options = null ) Constructs an empty ezcMail object.
__get ( string $name ) : mixed Returns the property $name.
__isset ( string $name ) : boolean Returns true if the property $name is set, otherwise false.
__set ( string $name, mixed $value ) Sets the property $name to $value.
addBcc ( ezcMailAddress $address ) Adds the ezcMailAddress $address to the list of 'bcc' recipients.
addCc ( ezcMailAddress $address ) Adds the ezcMailAddress $address to the list of 'cc' recipients.
addTo ( ezcMailAddress $address ) Adds the ezcMailAddress $address to the list of 'to' recipients.
fetchParts ( array(string) $filter = null, boolean $includeDigests = false ) : array(ezcMailPart) Returns an array of mail parts from the current mail.
generateBody ( ) : string Returns the generated body part of this mail.
generateHeaders ( ) : string Returns the generated headers for the mail.
walkParts ( ezcMailPartWalkContext $context, ezcMailPart $mail ) Walks recursively through the mail parts in the specified mail object.

보호된 메소드들

메소드 설명
collectPart ( ezcMailPartWalkContext $context, ezcMailPart $mail ) Saves $mail in the $context object.

메소드 상세

__construct() 공개 메소드

Constructs an empty ezcMail object.
public __construct ( ezcMailOptions $options = null )
$options ezcMailOptions

__get() 공개 메소드

Returns the property $name.
public __get ( string $name ) : mixed
$name string
리턴 mixed

__isset() 공개 메소드

Returns true if the property $name is set, otherwise false.
public __isset ( string $name ) : boolean
$name string
리턴 boolean

__set() 공개 메소드

Sets the property $name to $value.
public __set ( string $name, mixed $value )
$name string
$value mixed

addBcc() 공개 메소드

Adds the ezcMailAddress $address to the list of 'bcc' recipients.
public addBcc ( ezcMailAddress $address )
$address ezcMailAddress

addCc() 공개 메소드

Adds the ezcMailAddress $address to the list of 'cc' recipients.
public addCc ( ezcMailAddress $address )
$address ezcMailAddress

addTo() 공개 메소드

Adds the ezcMailAddress $address to the list of 'to' recipients.
public addTo ( ezcMailAddress $address )
$address ezcMailAddress

collectPart() 보호된 정적인 메소드

This function is used as a callback in the fetchParts() method.
protected static collectPart ( ezcMailPartWalkContext $context, ezcMailPart $mail )
$context ezcMailPartWalkContext
$mail ezcMailPart

fetchParts() 공개 메소드

The array returned contains objects of classes: - ezcMailText - ezcMailFile - ezcMailRfc822Digest If the method is called with $includeDigests as true, then the returned array will not contain ezcMailRfc822Digest objects, but instead the mail parts inside the digests. The parameter $filter can be used to restrict the returned mail parts, eg. $filter = array( 'ezcMailFile' ) to return only file mail parts. A typical use for this function is to get a list of attachments from a mail. Example: $mail is an ezcMail object $parts = $mail->fetchParts(); after the above line is executed, $parts will contain an array of mail parts objects, for example one ezcMailText object ($parts[0]) and two ezcMailRfc822Digest objects ($parts[1] and $parts[2]). the ezcMailText object will be used to render the mail text, and the other two objects will be displayed as links ("view attachment") when user clicks on one of the two attachments, the parts of that attachment must be retrieved in order to render the attached digest: $subparts = $parts[1]->mail->fetchParts(); after the above line is executed, $subparts will contain an array of mail parts objects, for example one ezcMailText object and one ezcMailFile object
public fetchParts ( array(string) $filter = null, boolean $includeDigests = false ) : array(ezcMailPart)
$filter array(string)
$includeDigests boolean
리턴 array(ezcMailPart)

generateBody() 공개 메소드

Returns an empty string if no body has been set.
public generateBody ( ) : string
리턴 string

generateHeaders() 공개 메소드

This method is called automatically when the mail message is built. You can re-implement this method in subclasses if you wish to set different mail headers than ezcMail.
public generateHeaders ( ) : string
리턴 string

walkParts() 공개 메소드

$context is an object of class ezcMailPartWalkContext, which must contain a valid callback function name to be applied to all mail parts. You can use the collectPart() method, or create your own callback function which can for example save the mail parts to disk or to a database. For the properties you can set to the walk context see: {@link ezcMailPartWalkContext} Example: class App { public static function saveMailPart( $context, $mailPart ) { code to save the $mailPart object to disk } } use the saveMailPart() function as a callback in walkParts() where $mail is an ezcMail object. $context = new ezcMailPartWalkContext( array( 'App', 'saveMailPart' ) ); $context->includeDigests = true; // if you want to go through the digests in the mail $mail->walkParts( $context, $mail );
public walkParts ( ezcMailPartWalkContext $context, ezcMailPart $mail )
$context ezcMailPartWalkContext
$mail ezcMailPart

프로퍼티 상세

$options 보호되어 있는 프로퍼티

Holds the options for this class.
protected ezcMailOptions $options
리턴 ezcMailOptions