我有关于使用codeigniter电子邮件库的smtp的问题。它与smtp.gmail.com一起工作正常但在这种情况下我必须使用vpn。我找到了其他解决方案,如smtp.exmail.qq.com,smtp.mail.yahoo.com或smtp.sina.com,但是当您发送表单在电子邮件字段中键入您的电子邮件时,它仅使用您在smtp用户中提供的电子邮件发送。请进一步查看我的代码和屏幕截图enter image description here:
//get the form data
$name = $this->input->post('name');
$from_email = $this->input->post('email');
$subject = $this->input->post('subject');
$message = $this->input->post('message');
//set to_email id to which you want to receive mails
$to_email =
'info@sample.com';
//configure email settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.exmail.qq.com';
//'ssl://smtp.googlemail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'myemail@exmail.qq.com';
$config['smtp_pass'] = 'my password';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes
//$this->load->library('email', $config);
$this->email->initialize($config);
//send mail
$this->email->from($from_email, $name);
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);