2017-02-01 2 views
0

私はSMTPsendmail、およびmail()をPHPコードネイターで新しくしました。codeigniterアプリケーションでSMTPを設定する方法は?

私はcodeigniterアプリケーションでSMTPメールプロトコルを設定しようとしています。シングルユーザーのすべての設定、SMTPポート、送信者メール、ユーザーID、パスワード([email protected])を作成します。それは正常に動作します。

私の質問は、1つのアプリケーションで2つのSMTPユーザーアカウントを設定できますか?

たとえば、[email protected] .comと[email protected]を設定して、これら2人のユーザーがメールを顧客に送信できるようにしたいとします。

+0

あなたのsendmail関数コードをスニペットで表示できますか? –

+0

通常のCPU上で量子力学を話さない限り、すべて可能です。しかし、そのすべては、コードを必要とし、私は何も見ていないよ。 – Xorifelse

答えて

1

あなたはconfigに変更のみで、それを使用することができます。

$config = Array(
    'protocol' => 'smtp', 
    'smtp_host' => 'ssl://smtp.googlemail.com', 
    'smtp_port' => 465, 
    'smtp_user' => 'xxx', // First user authenticate 
    'smtp_pass' => 'xxx', 
    'mailtype' => 'html', 
    'charset' => 'iso-8859-1' 
); 
$this->load->library('email', $config); 
$this->email->set_newline("\r\n"); 

// Set to, from, message, etc. 

$result = $this->email->send(); 

$config = Array(
    'protocol' => 'smtp', 
    'smtp_host' => 'ssl://smtp.googlemail.com', 
    'smtp_port' => 465, 
    'smtp_user' => 'yyy', // Second user authenticate 
    'smtp_pass' => 'zzzz', 
    'mailtype' => 'html', 
    'charset' => 'iso-8859-1' 
); 
$this->load->library('email', $config); 
$this->email->set_newline("\r\n"); 

// Set to, from, message, etc. 

$result = $this->email->send(); 

などしかし、一つだけは、サーバーでのメールユーザーの両方を設定する必要があるということです。ありがとう

関連する問題