問い合わせが完了した時にメールを送信する機能をつけるため、AWSのSMTPを使ったところ以下のエラーが生じました。
PHP
1// /contact_complete画面 2220 smtp.qq.com Esmtp QQ Mail Server 3 4hello: 5The following SMTP error was encountered: 6Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. 7User-Agent: CodeIgniter 8Date: Thu, 18 Mar 2021 00:30:48 +0000 9From: "Your name" <xx@xxx.cn> 10Return-Path: <xx@mxxx.cn> 11To: XXX@gmail.com 12Subject: =?UTF-8?Q?This=20is=20an=20email=20test?= 13Reply-To: <xx@mxxx.cn> 14X-Sender: xx@mxxx.cn 15X-Mailer: CodeIgniter 16X-Priority: 3 (Normal) 17Message-ID: <60529f382cd31@playable.cn> 18Mime-Version: 1.0 19 20 21Content-Type: multipart/alternative; boundary="B_ALT_60529f382cd47" 22 23This is a multi-part message in MIME format. 24Your email application may not support this format. 25 26--B_ALT_60529f382cd47 27Content-Type: text/plain; charset=UTF-8 28Content-Transfer-Encoding: 8bit 29 30it it working:) 31 32 33--B_ALT_60529f382cd47 34Content-Type: text/html; charset=UTF-8 35Content-Transfer-Encoding: quoted-printable 36 37it it working:) 38 39--B_ALT_60529f382cd47--
この時のcontrollerでのコードは以下です。
codeigniter
1public function contact_complete(){ 2 $post = $this->input->post(); 3 $this->Bll_user->contact_save($post); 4 5 $config['protocol'] = 'smtp'; 6 $config['smtp_host'] = 'xxx.com'; 7 $config['smtp_crypto'] = 'ssl'; 8 $config['smtp_user'] = 'xxx'; 9 $config['smtp_pass'] = 'xxx'; 10 $config['smtp_port'] = '465'; 11 $config['smtp_timeout'] = '30'; 12 $config['newline'] = "\r\n"; 13 $config['crlf'] = "\r\n"; 14 $config['mailtype'] = "html"; 15 $config['smtp_crypto'] = 'ssl'; 16 $config['from'] = 'xx@xxx.cn'; 17 $config['from_name'] = 'test'; 18 19 $this->load->library("email", $config); 20 $this->email->set_newline("rn"); 21 22 $this->email->from($config['from'], "Your name"); 23 $this->email->to("xxx@gmail.com"); 24 $this->email->subject("This is an email test"); 25 $this->email->message("it it working:)"); 26 27 if($this->email->send()){ 28 echo 'success'; 29 }else{ 30 show_error($this->email->print_debugger()); 31 } 32 }
お手数おかけしますが、エラーが起きる原因を教えていただきたいです。
よろしくお願いします。
あなたの回答
tips
プレビュー