Codeigniter SMTP Email with Amazon SES

后端 未结 5 1930
天命终不由人
天命终不由人 2021-02-05 06:43

I think yesterday Amazon announced SMTP support for SES (Simple Email Service).

I tried to send SMTP email with Codeigniter with no luck.

I have a verified sende

5条回答
  •  再見小時候
    2021-02-05 07:01

    public function enviar_email($para, $assunto, $mensagem, $formato='html'){
                $this->CI->load->library('email');
                $config['mailtype']     = $formato;
                $config['useragent']    = 'Post Title';
                $config['protocol']     = 'smtp';
                $config['smtp_host']    = 'tls://email-smtp.us-east-1.amazonaws.com';
                $config['smtp_user']    = 'smtpuser';
                $config['smtp_pass']    = 'smtppass';
                $config['smtp_port']    = '465';
                $config['wordwrap']     = TRUE;
                $config['newline']      = "\r\n"; 
    
                $this->CI->email->initialize($config);
    
                $this->CI->email->from('Your Verified Sender Email', 'Post Title');
                $this->CI->email->to($para);
                $this->CI->email->subject($assunto);
                $this->CI->email->message($mensagem);
    
    
                if($this->CI->email->send()):
                        return TRUE;
                else:
                        $this->CI->email->print_debugger();
                endif;
    
        } 
    

提交回复
热议问题