• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Email class not working all the time.

#1
[eluser]Unknown[/eluser]
Hi Guys,

Hope you can help. I am using the email class and it is working fine on my local web server (Wamp) but when I upload my site to my web host it doesn't work.

Also, I tried it on another Wamp server and the email doesn't come through either!? I'm not sure if there is a required PHP ext or Apache mod that I should activate.

This is my email class. Are the any prerequisites I should be considering?
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Email_model extends CI_Model {

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

function send_cc($data, $from_e='[email protected]', $from_n = 'Stridon LTD')
{

   //BOF] email
   $this->load->library('email');
  
   $config['protocol']    = 'smtp';
      $config['smtp_host']    = 'smtp.gmail.com';
      $config['smtp_port']    = '587';
      $config['smtp_timeout'] = '10';
      $config['smtp_user']    = '<REMOVED>@gmail.com';
     $config['smtp_pass']    = '<REMOVED>';
      $config['charset']    = 'utf-8';
     $config['newline']    = "\r\n";
     $config['mailtype'] = 'html'; // html or text
     $config['validation'] = TRUE; // bool whether to validate email or not  

      $this->email->initialize($config);
   $this->email->from($from_e, $from_n );
   $this->email->to( $data['email_to'] );
   $this->email->cc( $data['email_cc'] );
   $this->email->bcc( $data['email_bcc'] );
  
  
   $this->email->subject($data['subject']);
   $this->email->message("
    &lt;html&gt;
    &lt;head&gt;&lt;title>" . $data['subject'] . "&lt;/title&gt;
    &lt;style&gt;
     a {color: #3B5998;text-decoration:none;}
    &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;  
     <p><b>What: </b>" . $data['what'] . "</p>
     <p><b>Why: </b>" . $data['why'] . "</p>
     <p><b>When: </b>" . $data['when'] . "</p>
     <p><b>Urgency: </b>" . $data['urgency'] . "</p>
     <p><b>Impact: </b>" . $data['impact'] . "</p>
     <p><b>Suspend Alarms on Nodes: </b>" . $data['suspend'] . "</p>
     <p><b>Change Executor: </b>" . $data['executor'] . "</p>
     <p><b>Ticket Ref: </b>#" . $data['ticket'] . "</p>
     <p><b>Client Approval: </b>" . $data['approval'] . " <b> By: </b>" . $data['approval_by'] . "</p>
     <p><b>Details: </b>" . $data['details'] . "</p>
    &lt;/body&gt;
    &lt;/html&gt;
   ");
   $this->email->send();
   //EOF send email  
}
}

Thanks for reading this, hope you can help me.

#2
[eluser]Unknown[/eluser]
Great thanks for the help guys..


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.