CodeIgniter Forums
Codeigniter email - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Codeigniter email (/thread-24591.html)

Pages: 1 2


Codeigniter email - El Forum - 11-13-2009

[eluser]GamingFusion[/eluser]
ok I am trying to create a simple email form.

When i go to send a message i get a bunch of error like

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1329

What am i missing?

Heres my sendEmail Code
Code:
function sendMail()
    {
        $admine = '[email protected]';
        
        $this->load->library('email');

        $this->email->from($this->input->post('email'), $this->input->post('name'));
        $this->email->to($admine);

        $this->email->subject($this->input->post('subject'));
        $this->email->message($this->input->post('message'));
        
        $config['validate'] = TRUE;
        
        $this->email->initialize($config);

        $this->email->send();

        echo $this->email->print_debugger();    
    }



Codeigniter email - El Forum - 11-13-2009

[eluser]Hani A.[/eluser]
Did you make sure your two input variables actually have a value?

Echo $this->input->post('email') and $this->input->post('name') to make sure.


Codeigniter email - El Forum - 11-13-2009

[eluser]GamingFusion[/eluser]
yup they have values


Codeigniter email - El Forum - 11-13-2009

[eluser]GamingFusion[/eluser]
could it bee the server?


Codeigniter email - El Forum - 11-13-2009

[eluser]Hani A.[/eluser]
Not sure. Can you show me the debugger code that gets echoed to the page?


Codeigniter email - El Forum - 11-13-2009

[eluser]GamingFusion[/eluser]
User-Agent: CodeIgniter
Date: Fri, 13 Nov 2009 18:50:11 -0500
Reply-To: "" <>
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <4afdf0b32a548>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit


Codeigniter email - El Forum - 11-13-2009

[eluser]Hani A.[/eluser]
Yup - your "Reply-To:" header is completely empty. (As shown in the debug info.)

Try hard coding info for the "From" setting just to see if it works.

Replace this:
Code:
$this->email->from($this->input->post('email'), $this->input->post('name'));

With this:
Code:
$this->email->from("[email protected]", "Me");

If that works, then something is wrong with your post values.

(If you are running on localhost or sending via SMTP instead of the default "mail", you may get another error when trying to send from "[email protected]".)


Codeigniter email - El Forum - 11-13-2009

[eluser]GamingFusion[/eluser]
nope still nothing for the Reply-To


Codeigniter email - El Forum - 11-13-2009

[eluser]GamingFusion[/eluser]
Here is all the warning and errors i get when i run the file.

I added some breaks and stuff to make it easier to read

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1329
----------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 921
----------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 570
----------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined index: Subject

Filename: libraries/Email.php

Line Number: 940
----------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1519
----------------------------------
A PHP Error was encountered

Severity: Warning

Message: mail() expects parameter 1 to be string, array given

Filename: libraries/Email.php

Line Number: 1519
----------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 921
----------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 570
----------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined index: Subject

Filename: libraries/Email.php

Line Number: 940
----------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1519
----------------------------------
A PHP Error was encountered

Severity: Warning

Message: mail() expects parameter 1 to be string, array given

Filename: libraries/Email.php

Line Number: 1519

Would the errors have anything to do with it not working?


Codeigniter email - El Forum - 11-13-2009

[eluser]web_developer[/eluser]
can you check simple mail function is working?

@mail(TO,SUBJECT,MESSAGE,HEADERS);

I think something looks wrong with mail service.

if(@mail) will work then something missing in CI else, Something wrong in mail Service