Welcome Guest, Not a member yet? Register   Sign In
How to set email config different from 'mail', 'sendmail', or 'smtp'
#1
Question 

In one of my projects in CI, I need to use Amazon SDK API instead of Amazon SMTP. I have created a PHP file at "application/config" and add the following code to email.php. 

My Amazon SMTP configuration sending correct email but now as per my requirement, I need to change SMTP to SDK API.

I have searched many articles all showing CI email setup using SMTP in the configuration but not as SDK API using key & password.

My working SMTP configuration is shown below 

PHP Code:
$config['protocol']        = 'smtp'// 'mail', 'sendmail', or 'smtp'
$config['smtp_host']    = 'mtp.example.com';
$config['smtp_user']    = '[email protected]';
$config['smtp_pass']    = 'xxxxxxxxxx';
$config['smtp_crypto']    = 'tls';
$config['smtp_port']    = '587';
$config['mailtype']    = 'html';
$config['newline']    = "\r\n"

Please suggest how to replace this SMTP configuration with Amazon SDK so that I can use a secret key and password. Instead of SMTP details.
Reply
#2

Hi, you can't. It's to different protocols. You need to use their own PHP AWK SDK library to send emails. Or code your own with cURL, but that would take forever.
Reply
#3

(This post was last modified: 06-12-2020, 08:23 AM by jreklund.)

(06-11-2020, 10:44 AM)jreklund Wrote: Hi, you can't. It's to different protocols. You need to use their own PHP AWK SDK library to send emails. Or code your own with cURL, but that would take forever.


Thanks, I have created my own custom library and used my custom library function instead of CI $this->email->send() function. It is working fine I have followed Amazon documentation at https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-using-sdk-php.html

I
n my controllers, I have replaced $this->email->send() call with my new $SesClient->sendEmail() function.  In my project earlier developer has used ION Auth so when any new user register himself he will receive an account activation email that is not in any controller but ION auth library to send an email. When I looked into the code I found that ION Auth using CI default email feature set in the configuration. This is the reason I am looking for a solution so that it will work ION Auth send Activation email or Resend Activation email as well. Please suggest. Do I need to modify Ion_auth library  or there is an alternative correct way?
Reply
#4

You will need to modify or extend ion auth. I'm not quite sure you can extend/replace Codeigniters own mail function.
Reply
#5

I would modify Ion_auth to use the custom library.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB