Welcome Guest, Not a member yet? Register   Sign In
email without content
#1

[eluser]tfncruz[/eluser]
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:
Code:
public function send() {
    $config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'localhost',
            'smtp_user' => 'xxxxx',
            'smtp_pass' => 'xxxxx',
                'validate'  => TRUE ,
                'priority'  => 3 , //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('[email protected]', '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 .= "&lt;/body&gt;&lt;/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!
#2

[eluser]Twisted1919[/eluser]
try with :
Code:
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->
#3

[eluser]tfncruz[/eluser]
same behavior... the problem is not the "{}"...
#4

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

You tried like that ?
#5

[eluser]tfncruz[/eluser]
That solved the problem!
Thank you very much!

I thought he could understand the message as a parameter inside the send function...
#6

[eluser]Twisted1919[/eluser]
Well it doesn't work like that Tongue
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




Theme © iAndrew 2016 - Forum software by © MyBB