With this class you can send email from any place in your application. In addition to using the EmailComponent from your controller, you can also send mail from Shells and Models. This class replaces the EmailComponent and gives more flexibility in sending emails. For example, you can create your own transports to send email instead of using the provided SMTP and Mail transports.

Author:Meztizshura Brarisar
Language:English (Spanish)
Published (Last):6 February 2014
PDF File Size:2.17 Mb
ePub File Size:19.59 Mb
Price:Free* [*Free Regsitration Required]

When sending templated emails you have the option of sending either text, html or both. By default only the HtmlHelper is loaded. In some cases, you might need to override the default template provided by plugins. Deprecated since version 3. The recipient will see photo. The mimetype and contentId are optional in this form.

You can use the contentDisposition option to disable the Content-Disposition header for an attachment. This is useful when sending ical invites to clients using outlook. This allows you to attach files without needing file paths to them. If you do not want to send the email right away, and wish to configure a few things before sending, you can pass the 5th parameter as false.

The 3rd parameter is the content of message or an array with variables when using rendered content. The 4th parameter can be an array with the configurations or a string with the name of configuration in Configure.

If you want, you can pass the to, subject and message as null and do all configurations in the 4th parameter as array or using Configure. Check the list of configurations to see all accepted configs. Mailers allow you to create reusable emails throughout your application. They can also be used to contain multiple email configurations in one location. This helps keep your code DRYer and keeps email configuration noise out of other areas in your application. In this example we will be creating a Mailer that contains user-related emails.

Each of these methods expect a user Entity and utilizes its properties for configuring each email. We are now able to use our UserMailer to send out our user-related emails from anywhere in our application.

The EmailTrait provides your test case with a collection of assertions that you can perform on any emails sent by the application.

This transport intercepts emails instead of sending them, and allows you to assert against them.


Class Email



Subscribe to RSS


Related Articles