I have setup my web app on ec2 ubuntu 18.04 with apache server, to send email notification, I've configured AWS SES and obtained SMTP credentials as per following link - https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html
following is my php codes to send email -
$mail_config['smtp_host'] = 'email-smtp.us-west-2.amazonaws.com';
$mail_config['smtp_port'] = '465';
$mail_config['smtp_user'] = 'xxxx';
//$mail_config['_smtp_auth'] = TRUE;
$mail_config['smtp_pass'] = 'xxxx';
$mail_config['smtp_crypto'] = 'ssl';
$mail_config['protocol'] = 'smtp';
$mail_config['mailtype'] = 'html';
$mail_config['send_multipart'] = FALSE;
$mail_config['charset'] = 'utf-8';
$mail_config['wordwrap'] = TRUE;
$this->email->initialize($mail_config);
$this->email->from('info@mydomain.co', 'info');
$this->email->to('my_gmail_address_here');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
if($this->email->send()){
echo "Sent";
} else {
echo $this->email->print_debugger();
}
but it throws -
The following SMTP error was encountered: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
I have opened SMTP and SMTPS ports as well. Is there anything else I need to check??
Update - I tried it on another server but it says Failed to authenticate password. Error: 535 Authentication Credentials Invalid Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Update 1 - my overall architecture is as follows -
- Purchased domain from Google
- Deployed web app on EC2 (Ubuntu 18.04 with apache server)
- Created hosted zone in Route53
- Updated google domain DNS (NS record ) with custom NS from Route53
- Attached EC2 with Application Load Balancer
SSL obtained from AWS Certificate Manager