• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending email using smtp doesn't work

#1
The following code doesn't work (no email is received) 
PHP Code:
<?php namespace App\Controllers;

class 
Email extends BaseController
{
    public function 
index()
    {
        $config['protocol'] = 'smtp';
        $config['charset']  'iso-8859-1';
        $config['wordWrap'] = true;
        $config['SMTPHost'] = 'ssl://smtp.gmail.com';
        $config['SMTPUser'] = '[email protected]';
        $config['SMTPPass'] = 'xxx';
        $config['SMTPCrypto'] = 'ssl'// tls or ssl
        $config['SMTPPort'] = 465// tls:587  ssl:465
        $config['mailType'] = 'html';

        $email = \Config\Services::email();
        $email->initialize($config); // Use the config above

        $email->setFrom('[email protected]''xxx');
        $email->setTo('[email protected]');
        $email->setSubject('Email Test');
        $email->setMessage('Testing the email class.');
        $email->send();
    }

Reply


Messages In This Thread
Sending email using smtp doesn't work - by muuucho - 04-13-2020, 10:17 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.