Welcome to the Cookbook

loading...

5.4.1 Class Attributes and Variables

There is no translation yet for this section. Please help out and translate this.. More information about translations

These are the values that you can set before you call EmailComponent::send()

toAddress the message is going to (string). Separate the addresses with a comma if you want to send the email to more than one recipient.
ccarray of addresses to cc the message to
bccarray of addresses to bcc (blind carbon copy) the message to
replyToreply to address (string)
returnReturn mail address that will be used in case of any errors(string) (for mail-daemon/errors)
fromfrom address (string)
subjectsubject for the message (string)
templateThe email element to use for the message (located in app/views/elements/email/html/ and app/views/elements/email/text/)
layoutThe layout used for the email (located in app/views/layouts/email/html/ and app/views/layouts/email/text/)
lineLengthLength at which lines should be wrapped. Defaults to 70. (integer)
sendAshow do you want message sent string values of text, html or both
attachmentsarray of files to send (absolute and relative paths)
deliveryhow to send the message (mail, smtp [would require smtpOptions set below] and debug)
smtpOptionsassociative array of options for smtp mailer (port, host, timeout, username, password, client)

There are some other things that can be set but you should refer to the api documentation for more information

5.4.1.1 Sending Multiple Emails in a loop

There is no translation yet for this section. Please help out and translate this.. More information about translations

If you wish to send multiple emails using a loop, you'll need to reset the email fields using the reset method of the Email component. You'll need to reset before setting the email properties again.

$this->Email->reset()
  1. $this->Email->reset()