Reputation: 2007
I'm using codeigniter to send mail. It works fine but having this weird problem. The mail is delivered to the recipient and it shows the subject. But it won't show the message and attachment.
Here is the code. I think it's a silly mistake I just can't detect. Help me!
//configure email settings
$config = array(
'protocol'=>'smtp',
'smtp_host'=> 'ssl://smtp.gmail.com',
'smtp_port'=>'465',
'smtp_user'=>'xxxxxxxxxxxxxxxx',
'smtp_pass'=>'xxxxxxxxxxxxxxxx',
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]','myname');
$this->email->to($email);
$this->email->subject('Test');
$this->email->message('It works!');
//attach newsletter to email
$path=$this->config->item('server root');
$file=$path . '/codeigniter/attachments/newsletter.txt';
$this->email->attach($file);
if($this->email->send())
{
echo "your email was sent";
}
else
{
show_error($this->email->print_debugger());
}
Upvotes: 0
Views: 840
Reputation: 8382
Try changing set_newline to:
$this->email->set_newline("\n");
I have had similar issues in the past, and this fixed it for me.
Upvotes: 1