Welcome Guest, Not a member yet? Register   Sign In
Cannot send mail with no "From" header.
#1

Hello.

I am using Codeigniter 3 and when i try to send email i get this error
Cannot send mail with no "From" header.
But the email still sends i got them in my mail.

But when i use condition
Code:
if (!$this->email->send())
{
 echo $this->email->print_debugger();
}
It says that cannot send mail with no "From" header but the email stil sends.

My preferences are located in the config/email.php
Here is my code.

     
Code:
$this->load->library('email');
$this->email->from('[email protected]');
$this->email->reply_to('[email protected]');
$this->email->to('[email protected]');
$this->email->subject($this->input->post('emailheading'));
$this->email->message($this->input->post('emailmessage'));
$this->email->set_alt_message($this->input->post('emailmessage'));
$this->email->send();

 if (!$this->email->send())
{    
echo $this->email->print_debugger();
                
}

Any help will be appreciated
Reply
#2

Anyone ?
Reply
#3

What is the error you are getting?
Can you paste it here so we can take a look.

Thanks.
Proprietor and Developer:

http://app-arsenal.com
http://senhosting.com
Reply
#4

In your code you've already used $this->email->send() before using again $this->email->send() in your if statement. The library, after you send an email, clears everything. So, if you want to do something in case of error you don't do the same method twice:


PHP Code:
$this->load->library('email');
$this->email->from('[email protected]');
$this->email->reply_to('[email protected]');
$this->email->to('[email protected]');
$this->email->subject($this->input->post('emailheading'));
$this->email->message($this->input->post('emailmessage'));
$this->email->set_alt_message($this->input->post('emailmessage'));
// $this->email->send(); don't do this and then the same thing!

 
if (!$this->email->send())
   
echo $this->email->print_debugger();
 
               

Reply




Theme © iAndrew 2016 - Forum software by © MyBB