ucym / CodeLapse

Fast coding for Small-scale PHP projects.
http://ucym.github.io/CodeLapse/
0 stars 1 forks source link

Mail wrapper #2

Closed ucym closed 9 years ago

ucym commented 9 years ago

Feature

class D5_Mail
{
  public __construct([array $config = array()])

  // Setting mail from
  public from(string $address) : D5_Mail

  // #to(), #cc(), #bcc() is push email address to interal list.
  //   join in before mail sending.

  // $to is valid mail address or array of valid email addresses.
  public to(array | string $to) : D5_Mail
  // $cc is valid mail address or array of valid email addresses. 
  public cc(array | string $cc) : D5_Mail
  // $bcc is valid mail address or array of valid email addresses.
  public bcc(array | string $bcc) : D5_Mail

  // Set subject
  // $subject is must be no contain EOL string.
  // if EOL contain, throw D5_Mail_InvalidSubjectException
  public subject(string $subject) : D5_Mail

  // Set mail body
  public body(string $body) : D5_Mail

  // Set mail body as HTML
  public htmlBody(string $body) : D5_Mail

  // add filepath to internal attaches list.
  // array is allowed contain valid file path or D5_File instance
  public attachFile(string | D5_File | array $file) : D5_Mail

  // send the mail.
  // if address list contains invalid address, or No exists file attached, throw D5_Mail_Exception
  // if mail submit failed, throw D5_Mail_Exception
  public send() : void
}
ucym commented 9 years ago

Implemented in be094a5