Welcome Guest, Not a member yet? Register   Sign In
Strange goings on with email class
#1

[eluser]Unknown[/eluser]
Hi people, I need to know whether anyone else has experienced strange goings on with the email class.

lets start by looking at my code...

Code:
class booking extends CI_Controller {
    
    public function index()
    {
        $this->load->library('form_validation');
        
        $data['title'] = 'Make a Booking';
        $data['css'] = '';
        $data['js'] = '';
        
        $this->form_validation->set_error_delimiters('<p class="error">', '</p>');

        $this->form_validation->set_rules('name', 'Name', 'required');
        $this->form_validation->set_rules('telephone', 'Contact Telephone', 'required');
        $this->form_validation->set_rules('people', 'Number of People', 'required');
        $this->form_validation->set_rules('fromdate', 'From Date', 'required');
        $this->form_validation->set_rules('todate', 'To Date', 'required');
        
        if($this->form_validation->run() == FALSE) {
            
            $this->load->view('layout/header', $data);
            $this->load->view('pages/booking');
            $this->load->view('layout/footer');
            
        } else {
            
            $this->load->library('email');
            $config['mailtype'] = 'html';

            $this->email->initialize($config);

            $this->email->from('website@**********.com', '**********');
            $this->email->to('enquires@************.com');
            $this->email->cc('another@**********.co.uk');

            $this->email->subject('Accommodation Enquiry');
            $this->email->message('
                <h1>Accommodation Enquiry</h1>
                <p>Name:        '.$this->input->post('name').'</p>
                <p>E-Mail:      '.$this->input->post('email').'</p>
                <p>Telephone:   '.$this->input->post('telephone').'</p>
                <p>No. People:  '.$this->input->post('people').'</p>
                <p>From date:   '.$this->input->post('fromdate').'</p>
                <p>To Date:     '.$this->input->post('todate').'</p>
                <p>Message:     '.$this->input->post('additionalinfo').'</p>
                ');

            $this->email->send();
            
            $data['js'] = '[removed]$(document).ready(function(){$("#contact_form").hide("slow");$("#contact_thanks").show("slow");})[removed]';
            
            $this->load->view('layout/header', $data);
            $this->load->view('pages/booking');
            $this->load->view('layout/footer');
            
        }
        
                
    }
}

(p.s. for those who do not know it says [removed] in my $data['js'] because there is the script tag)

Now, the problems lies with sending the email, it seems to only deliver to the cc or bcc address and not to the to address, no matter what i do. for instance in the above example if i send, as is, it will only send to the cc and if i swap the addresses around it goes to the other address so no issues with any account recieving the email, i have tried with all different email accounts with the same result, (gmail, me.com, gmx.com, my own domains, etc etc)

now it gets stranger, when the cc recieves the mail, it displays as if it was sent to the to address, ( i hope you understand this, i.e. if you recieve an email it says "to: [email protected]" or your display name these email are displaying the email address of the to address but not actually going there! ) odd huh!!

if this was a bug surely more people would have reported it, but i have found nothing. a little help please?!?!

further info: dev environment = Codeigniter 2.1.0, OS X 10.7.3, Netbeans 7.0.1, MAMP 2.0.5

pps. print_debugger show all is ok, no issues, have also tried with plain text with same results
#2

[eluser]skunkbad[/eluser]
It sounds like you are going to need to do some debugging inside the Email library. I use Firephp, but You could use whatever you like. The Email class is not very large, so you probably wont spend that much time figuring out what is going on.
#3

[eluser]InsiteFX[/eluser]
Note:

If you send HTML email you must send it as a complete web page. Make sure you don't have any relative links or relative image paths otherwise they will not work.

You could also have a corrupted email class file!

I use the email class all the time with no problems.
#4

[eluser]aquary[/eluser]
[quote author="InsiteFX" date="1329951980"]Note:

If you send HTML email you must send it as a complete web page. Make sure you don't have any relative links or relative image paths otherwise they will not work.

You could also have a corrupted email class file!

I use the email class all the time with no problems.
[/quote]

The message "MUST be in a complete web page"? I'd not say that since I never got any error with a "Half complete" mail, without &lt;html&gt; or &lt;body&gt;.

If the file was corrupted, it shouldn't be usable at all... and the stuff you spoke about images path doesn't make sense here since it was not about "Image not appear" nor "Broken Links"...

Anyway, try the $this->email->print_debugger() to see what was happening during the sending. You could also check inside the Email class for the sending method, and try running the same code manually. If the mail() or
#5

[eluser]skunkbad[/eluser]
Is there any chance that one of the associated files got saved as UTF8 with BOM? This has screwed various things up for me in the past.
#6

[eluser]InsiteFX[/eluser]
@aquary

I have downloaded CodeIgniter before 3 times before I got it work, but everything worked fine until I started using certain libraries!
#7

[eluser]aquary[/eluser]
Can you be more specific about that "certain libraries"? O_o




Theme © iAndrew 2016 - Forum software by © MyBB