Welcome Guest, Not a member yet? Register   Sign In
Problem with sent email
#1

[eluser]Halan Batista[/eluser]
Hello...

How are you?

I am having difficulties.

I have a code for sending e-mail, but it sends twice the same email but in different ways.

Follow the code below:

Code:
//faz envio de e-mail                
            $config = Array(
                'protocol'        =>    'smtp',
                'smtp_host'        =>    'ssl://smtp.googlemail.com',
                'smtp_port'        =>    465,
                'smtp_user'        =>    '[email protected]',
                'smtp_pass'        =>    'pass',
                'wordwrap'        =>    FALSE,
                'mailtype'        =>    'html',
                'charset'        =>    'utf-8',
                'newline'        =>    "\r\n"
                );
            
            $this->load->library('email', $config);                                

            $this->email->from('[email protected]', 'User');
            $this->email->to($to);
            $this->email->bcc('[email protected]');
            
            $this->email->subject('Confirmação Compra');
            $this->email->message('Olá, '.$name.' <br><br> Você efetuou a compra da oferta: <strong>'.$buy.'</strong>!<br><br>Para imprimir seu voucher: link<br><br>Equipe');
            
            $this->email->send();
            
            if(    $this->email->send() ) {
                return true;
            } else {
                return false;
            }


The first email comes correct working links and text wrapping:

Code:
Olá, Halan Schlickmann

Você solicitou a recuperação de sua senha.

Para gerar uma nova senha, acesso o link: click here

Equipe Adoro
adoro.com


But the second gets no link and the text broken:

Code:
Olá, Halan Schlickmann

Você solicitou a recuperação de sua sen= ha.

Para gerar uma nova senha, acesso o link: click here

Equipe Adoro
adoro.com
#2

[eluser]Rok Biderman[/eluser]
These two lines both send email, so it's only normal you get it twice.

Code:
$this->email->send();
            
            if(    $this->email->send() ) {

It's also a bit hard to imagine what the if clause is supposed to do. I suggest you do something like this:

Code:
$data['message']=$this->email->send()?'Message successfully sent!':'Error while sending!';

so you can use it easily in a further view to acknowledge the email being sent.
#3

[eluser]Halan Batista[/eluser]
Ohhh!! Greattt!!

Thanksss... It's work!!




Theme © iAndrew 2016 - Forum software by © MyBB