0

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 -

  1. Purchased domain from Google
  2. Deployed web app on EC2 (Ubuntu 18.04 with apache server)
  3. Created hosted zone in Route53
  4. Updated google domain DNS (NS record ) with custom NS from Route53
  5. Attached EC2 with Application Load Balancer

SSL obtained from AWS Certificate Manager

Dharman
  • 30,962
  • 25
  • 85
  • 135
Sachin Vairagi
  • 4,894
  • 4
  • 35
  • 61
  • Please try dropping `$mail_config['smtp_crypto'] = 'ssl';` and changing the smtp_host to 'ssl://email-smtp.us-west-2.amazonaws.com' – drussey Jun 30 '20 at 14:28
  • @drussey - I tried it too but didn't work. Most probably it should be some server settings. – Sachin Vairagi Jun 30 '20 at 14:32
  • Have you tried changing port to `587` as stated [here](https://stackoverflow.com/questions/45252547/unable-to-send-email-using-php-smtp-your-server-might-not-be-configured-to-send) – Justinas Jun 27 '23 at 12:19

0 Answers0