Skip to content

Instantly share code, notes, and snippets.

@kevinsmith
Created February 18, 2012 23:13
Show Gist options
  • Save kevinsmith/1861286 to your computer and use it in GitHub Desktop.
Save kevinsmith/1861286 to your computer and use it in GitHub Desktop.

Revisions

  1. kevinsmith revised this gist Feb 19, 2012. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions MY_Email.php
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,6 @@

    class MY_Email extends CI_Email {

    public function __construct()
    {
    parent::__construct();
    }

    /**
    * Set Vanity To address
    *
  2. kevinsmith created this gist Feb 18, 2012.
    52 changes: 52 additions & 0 deletions MY_Email.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    class MY_Email extends CI_Email {

    public function __construct()
    {
    parent::__construct();
    }

    /**
    * Set Vanity To address
    *
    * The Vanity To address is the address that is shown in the recipient's email
    * program, not the address to which the email is routed.
    *
    * @access public
    * @param string
    * @param string
    * @return void
    */
    public function vanity_to($to, $name = '')
    {
    if (preg_match( '/\<(.*)\>/', $to, $match))
    {
    $to = $match['1'];
    }

    if ($this->validate)
    {
    $this->validate_email($this->_str_to_array($to));
    }

    if ($name == '')
    {
    $name = $to;
    }

    if (strncmp($name, '"', 1) != 0)
    {
    $name = '"'.$name.'"';
    }

    $this->_set_header('To', $name.' <'.$to.'>');

    return $this;
    }

    }
    // END MY_Email class

    /* End of file MY_Email.php */
    /* Location: ./application/libraries/MY_Email.php */