使用codeigniter创建模板html验证电子邮件

时间:2015-10-09 04:21:10

标签: php html codeigniter

我正在尝试为我的电子邮件验证创建html模板。我用按钮更改了验证链接。但是当我打开电子邮件以验证验证链接是否未运行时。

这是我的剧本:

我的控制器

function submit() {

    //passing post data dari view
    $_POST['dob'] = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];

    $firstname = $this->input->post('firstname');
    $lastname = $this->input->post('lastname');     
    $password = $this->input->post('password');
    $email = $this->input->post('email');
    $dob = $this->input->post('dob');
    $jkl = $this->input->post('jkl');   
    $lastlogin = $this->input->post('lastlogin');


    //memasukan ke array
    $data = array(
        'firstname' => $firstname,
        'lastname' => $lastname,
        'password' => $password,
        'email' => $email,  
        'dob' => $dob,
        'jkl' => $jkl,
        'lastlogin' => $lastlogin,
        'active' => 0
    );

    $id = $this->m_register->add_account($data);

    //enkripsi id
    $encrypted_id = md5($id);

    $this->load->library('email');

    $config = Array(
    'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.gmail.com',
            'smtp_port' => 465,
            'smtp_user' => '******@******.com ',
            'smtp_pass' => '************',
            'mailtype'  => 'html', 
            'charset' => 'utf-8',
            'wordwrap' => TRUE
        );      

           $this->load->library('email', $config);
           $data = array('tes' => 'tester');
           $message = $this->load->view('v_email',$data,TRUE);               
           $this->email->set_newline("\r\n");
           $email_setting  = array('mailtype'=>'html');
           $this->email->initialize($email_setting);
           $this->email->from('com.es', 'xxx');
           $this->email->to($email);
           $this->email->subject('Confirmation Email');
           $this->email->message($message);


    if($this->email->send())
    {
    $data = array ( 'isi' => 'login/vsuccess');
            $this->load->view('layout/wrapper',$data);
    }else
    {
    $data = array ( 'isi' => 'login/vgagal');
            $this->load->view('layout/wrapper',$data);
    }


}   

我的观点v_email

   <div style="background-color:#f2f2f2">
        <center>
            <table style="background-color:#f2f2f2" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
                <tbody><tr>
                    <td style="padding:40px 20px" align="center" valign="top">
                        <table style="width:600px" border="0" cellpadding="0" cellspacing="0">
                            <tbody><tr>
                                <td align="center" valign="top">

                                </td>
                            </tr>
                            <tr>
                                <td style="padding-top:30px;padding-bottom:30px" align="center" valign="top">
                                    <table style="background-color:#ffffff;border-collapse:separate!important;border-radius:4px" border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tbody><tr>
                                            <td style="color:#606060;font-family:Helvetica,Arial,sans-serif;font-size:15px;line-height:150%;padding-top:40px;padding-right:40px;padding-bottom:30px;padding-left:40px;text-align:center" align="center" valign="top">
                                                <h1 style="color:#606060!important;font-family:Helvetica,Arial,sans-serif;font-size:40px;font-weight:bold;letter-spacing:-1px;line-height:115%;margin:0;padding:0;text-align:center">WELCOME </h1>
                                                <h1 style="color:#606060!important;font-family:Helvetica,Arial,sans-serif;font-size:40px;font-weight:bold;letter-spacing:-1px;line-height:115%;margin:0;padding:0;text-align:center">TO JOBRECRUIT</h1>
                                                <br>
                                                <h3 style="color:#606060!important;font-family:Helvetica,Arial,sans-serif;font-size:18px;letter-spacing:-.5px;line-height:115%;margin:0;padding:0;text-align:center"><?php echo $firstname;?> <?php echo $lastname; ?></h3>
                                                <br>
                                                Unutk verifikasi akun silahkan submit tautan dibawah ini.
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-right:40px;padding-bottom:40px;padding-left:40px" align="center" valign="middle">
                                                <table style="background-color:#6dc6dd;border-collapse:separate!important;border-radius:3px" border="0" cellpadding="0" cellspacing="0">
                                                    <tbody><tr>
                                                        <td style="color:#ffffff;font-family:Helvetica,Arial,sans-serif;font-size:15px;font-weight:bold;line-height:100%;padding-top:18px;padding-right:15px;padding-bottom:15px;padding-left:15px" align="center" valign="middle">
                                                            <a href="<?php echo base_url();?>login/register/verification/$encrypted_id" style="color:#ffffff;text-decoration:none" target="_blank">Aktifasi Akun</a>
                                                        </td>
                                                    </tr>
                                                </tbody></table>
                                            </td>
                                        </tr>
                                    </tbody></table>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" valign="top">
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tbody><tr>
                                            <td style="color:#606060;font-family:Helvetica,Arial,sans-serif;font-size:13px;line-height:125%" align="center" valign="top">
                                                 2015 Job Recruit<span style="font-size:10px!important;vertical-align:super">®</span>, All Rights Reserved.
                                                <br>
                                           </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top:30px" align="center" valign="top">
                                            </td>
                                        </tr>
                                    </tbody></table>
                                </td>
                            </tr>
                        </tbody></table>
                    </td>
                </tr>
            </tbody></table>
        </center>

0 个答案:

没有答案