EllisLab text mark
Advanced Search
     
email without content
Posted: 08 August 2009 04:15 PM   [ Ignore ]
Avatar
Joined: 2007-07-30
28 posts

Hi!
I have a function to send an email to a group of users (newsletter). The strange thing is that it sends the email but it goes without content! I already tried HTML email and Plain. Both goes without content.
Here’s the function:

public function send() {
    $config 
= Array(
            
'protocol' => 'smtp',
            
'smtp_host' => 'localhost',
            
'smtp_user' => 'xxxxx',
            
'smtp_pass' => 'xxxxx',
                
'validate'  => TRUE ,
                
'priority'  => //1-high,3-medium,5-normal
                //'mailtype'  => 'html',
            //'wordrap' => TRUE,
                
'crlf' => "\r\n" ,
                
'newline' => "\r\n",
            
'bcc_batch_mode' => TRUE
                
);
    
$this->email->initialize($config);
        
    
$this->email->from('geral@mail.com''nome');
    
$this->email->bcc($this->input->post('enderecos'));
    
$this->email->subject($this->input->post('subject'));
        
    
/*$message = "<html><body>";
    $message .= "<h1>Página Literária do Porto</h1>";
    $message .= "<h3>newsletter</h3>";
    $message .= "<div>".$this->input->post('message')."</div>";
    $message .= "<p>Contacto: </p>";
    $message .= "</body></html>";*/

    
$message $this->input->post('message');
        
    if (!
$this->email->send($message)) show_error($this->email->print_debugger());
    else 
{
        $this
->newsletters_model->set_newsletter();
            
$this->index('A newsletter foi enviada com sucesso');
    
}

Another thing… as you can see I save the email sent on a database table. I checked the record and it stores all the information (including the message)...

Any ideas?!

Thanks in advance!

 
Posted: 08 August 2009 04:20 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2008-12-14
544 posts

try with :

if (!$this->email->send()) 
        

         show_error
($this->email->print_debugger());
         
}
    
else {
        $this
->newsletters_model->set_newsletter();
        
$this->index('A newsletter foi enviada com sucesso');
         

And add the message to $this->email->

 
Posted: 08 August 2009 04:21 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-07-30
28 posts

same behavior… the problem is not the “{}”...

 
Posted: 08 August 2009 04:24 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2008-12-14
544 posts

I know , my suggestion was to set the message body with :
$this->email->message($message);

You tried like that ?

 
Posted: 08 August 2009 04:30 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2007-07-30
28 posts

That solved the problem!
Thank you very much!

I thought he could understand the message as a parameter inside the send function…

 
Posted: 08 August 2009 04:47 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2008-12-14
544 posts

Well it doesn’t work like that raspberry
When you set the $this->email->message() etc , you tell to the email class that the param named message has that value , Further , the email class will use that to append to the whole cycle for sending your email .

You welcome smile