Welcome Guest, Not a member yet? Register   Sign In
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



Theme © iAndrew 2016 - Forum software by © MyBB