Mails : setup

Setting up mail headers


The server() method is used to load the default setup either as an array or a file.

Setting up the mail headers as default through file can be done by setting up the web mail clients using the reserved variable $webmail within a file and using the setup() to load that file. The method accepts the filename or file path by using the dot convention. for example, a file path of mail/setup.php will be supplied as mail.setup . This makes it easier to load the server default headers.

1. File Setup Method
Sample: Setup File Configuration (setup.php)

  <?php

    // default configuration settings for mail
    $webmail['site']['mail']  = 'info@site.com';  // website mail e.g info@site.com
    $webmail['site']['name']  = 'website';        // mail header name or site name

    //default content settings - should be set later
    $webmail['header'] = ''; // optional - mail title e.g Welcome to ...
    $webmail['body']   = ''; // optional - mail content string or file

    //default user details - should be set later
    $webmail['client']['mail'] = ''; // optional- user email
    $webmail['client']['name'] = ''; // optional- user name 

  
Sample: Loading Server File

  <?php

    $mailer = new Mailer;

    $mailer->server('server'); // e.g server.php

  

2. Sync Setup Method
The array setup method is done by supplying the configuration arrays themselves directly into the sync() method. This method is used to modify default configurations on the go before forwarding the message. This is discussed here .