Welcome Guest, Not a member yet? Register   Sign In
Email class
#1

[eluser]Apfel1988[/eluser]
Hello,

i will use the Email class to send emails via codeigniter.

But when i send the form i have the following errors:
Code:
A PHP Error was encountered
Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1254

A PHP Error was encountered
Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 918
A PHP Error was encountered
Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 569

A PHP Error was encountered
Severity: Notice

Message: Undefined index: Subject

Filename: libraries/Email.php

Line Number: 937

A PHP Error was encountered
Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1444

A PHP Error was encountered
Severity: Warning

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

Filename: libraries/Email.php

Line Number: 1444




This is my php code:
Code:
$this->load->library('email');
            $this->load->helper('email');

            if(!$this->input->post('mail') || !valid_email($this->input->post('mail')))
                $data['error'] = 1;
            elseif(!$this->input->post('name')) $data['error'] = 2;
            elseif(!$this->input->post('message')) $data['error'] = 3;
            else{

                $this->email->from($this->input->post('mail'), $this->input->post('name'));
                $this->email->to('[email protected]');
                
                $this->email->subject('HP Anfrage');
                $this->email->message($this->input->post('message'));    
                
                $config['smtp_host'] = ...;
                $config['smtp_user'] = '...';
                $config['smtp_pass'] = '...';
                
                $this->email->initialize($config);
                $this->email->send();
                $data['ready'] = true;    
            }

I have valdiate the parameters for all email functions and tested via echo,..

Is anybody here who can tell me the Problem?

Thank you very much.
#2

[eluser]Apfel1988[/eluser]
Thank, i fixed the Problem.
Config must be initialised before set The email Informations,,, Wink
#3

[eluser]thephpx[/eluser]
my index() in controller welcome.php :

$this->load->library('email');
$config['protocol'] = 'sendmail';
$this->email->initialize($config);
$this->email->from('[email protected]', 'thephpx');
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();

response text:

Exit status code: 1
Unable to open a socket to Sendmail. Please check settings.
Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Mon, 16 Feb 2009 08:10:32 +0000
From: "thephpx"
Return-Path:
To: [email protected]
Subject: =?utf-8?Q?Email_Test?=
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Testing the email class.

Please suggest what is the problem
#4

[eluser]TheFuzzy0ne[/eluser]
Please post a new request instead of hijacking someone else's thread. Smile




Theme © iAndrew 2016 - Forum software by © MyBB