0

I have hosted my domain on amazon ec2 and i have added outbound rules for https (465) and custom tcp (587).

below are my email configuration

    $config['email_config'] = [
    'mailtype' => 'html',
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://email-smtp.ap-south-1.amazonaws.com',
    'smtp_port' => '587',
    'smtp_user' => 'AKIAZJ2TDSA******',
    'smtp_pass' => 'B*****N/aBD2mH3nWT4DiOfJ9NI3NRh*******',
    'smtp_crypto' => 'tls',
    'newline' => "\r\n"
];

And below are email sending code

        $this->email->clear();
        $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
        $this->email->reply_to($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
        $this->email->to('k3@vaksys.com');
        $this->email->subject('test subject');
        $this->email->message("test");

        if ($this->email->send())
        {
        //  echo $this->email->print_debugger();
            echo ' sent';
        }
        else
        {
            echo 'not sent';
        }

According above code, it always goes to if condition.

  • Codeigniter 3 email client is pretty useless IMO. You're better off composer requiring something like PHPMailer into the project. – Rager Feb 15 '23 at 04:44
  • But in the server which is hosted NOT on aws, email are working fine but in application hosted on aws, facing the issue. – Zivaan Solutions Feb 15 '23 at 06:57

1 Answers1

0
  1. what is the response from the server ? please put echo $this->email->print_debugger(); in the else{}.
  2. the smtp_host started with ssl:// , the encryption is really done on tls ?
  3. you set mailtype to html and the message not including html body (<html><head><title>test</title></head><body></body>Lorem ipsum dolor sit amet</html>).
neurodede
  • 100
  • 6
  • can you look into it also https://stackoverflow.com/questions/75464210/after-rebooting-amazon-ec2-instance-cant-access-instance-with-domain – Zivaan Solutions Feb 15 '23 at 18:47