PHP 인터페이스 yii\mail\MailerInterface

A mailer should mainly support creating and sending [[MessageInterface|mail messages]]. It should also support composition of the message body through the view rendering mechanism. For example, php Yii::$app->mailer->compose('contact/html', ['contactForm' => $form]) ->setFrom('[email protected]') ->setTo($form->email) ->setSubject($form->subject) ->send();
또한 보기: MessageInterface
부터: 2.0
저자: Paul Klimov ([email protected])
파일 보기 프로젝트 열기: yiisoft/yii2 0 사용 예제들

공개 메소드들

메소드 설명
compose ( string | array | null $view = null, array $params = [] ) : yii\mail\MessageInterface Creates a new message instance and optionally composes its body content via view rendering.
send ( yii\mail\MessageInterface $message ) : boolean Sends the given email message.
sendMultiple ( array $messages ) : integer Sends multiple messages at once.

메소드 상세

compose() 공개 메소드

Creates a new message instance and optionally composes its body content via view rendering.
public compose ( string | array | null $view = null, array $params = [] ) : yii\mail\MessageInterface
$view string | array | null the view to be used for rendering the message body. This can be: - a string, which represents the view name or path alias for rendering the HTML body of the email. In this case, the text body will be generated by applying `strip_tags()` to the HTML body. - an array with 'html' and/or 'text' elements. The 'html' element refers to the view name or path alias for rendering the HTML body, while 'text' element is for rendering the text body. For example, `['html' => 'contact-html', 'text' => 'contact-text']`. - null, meaning the message instance will be returned without body content.
$params array the parameters (name-value pairs) that will be extracted and made available in the view file.
리턴 yii\mail\MessageInterface message instance.

send() 공개 메소드

Sends the given email message.
public send ( yii\mail\MessageInterface $message ) : boolean
$message yii\mail\MessageInterface email message instance to be sent
리턴 boolean whether the message has been sent successfully

sendMultiple() 공개 메소드

This method may be implemented by some mailers which support more efficient way of sending multiple messages in the same batch.
public sendMultiple ( array $messages ) : integer
$messages array list of email messages, which should be sent.
리턴 integer number of messages that are successfully sent.