Gsuite 帐户不会发送电子邮件 codeigniter
Gsuite account won't send emails codeigniter
我刚刚为我的域设置了 google mx 记录。当我使用我的普通 gmail 帐户时,会发送电子邮件,但是当我使用我的 gsuite 帐户时,不会发送邮件。我在 siteground 上托管我的网站。但是我可以在我的 gsuite 帐户上接收来自其他电子邮件帐户的电子邮件。
$this->load->library('email');
$subject = 'Subject';
$message = 'My message';
//configure email settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = 465
$config['smtp_user'] = 'info@mydomain.com';
$config['smtp_pass'] = 'my_password';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes
$config['validation'] = TRUE;
$this->email->initialize($config);
//send mail
$this->email->from('info@mydomain.com', 'MyDomainName');
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);
//echo json_encode($this->email->print_debugger());
if($this->email->send())
return true;
else
return false;
您没有附加任何错误消息,但由于它适用于您的其他 Gmail 帐户,请尝试检查是否为此帐户打开对 "less secure apps" 的访问可以解决此问题并报告。
https://myaccount.google.com/lesssecureapps
(如果您登录了多个帐户,请不要忘记选择正确的帐户)。
我刚刚为我的域设置了 google mx 记录。当我使用我的普通 gmail 帐户时,会发送电子邮件,但是当我使用我的 gsuite 帐户时,不会发送邮件。我在 siteground 上托管我的网站。但是我可以在我的 gsuite 帐户上接收来自其他电子邮件帐户的电子邮件。
$this->load->library('email');
$subject = 'Subject';
$message = 'My message';
//configure email settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = 465
$config['smtp_user'] = 'info@mydomain.com';
$config['smtp_pass'] = 'my_password';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n"; //use double quotes
$config['validation'] = TRUE;
$this->email->initialize($config);
//send mail
$this->email->from('info@mydomain.com', 'MyDomainName');
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);
//echo json_encode($this->email->print_debugger());
if($this->email->send())
return true;
else
return false;
您没有附加任何错误消息,但由于它适用于您的其他 Gmail 帐户,请尝试检查是否为此帐户打开对 "less secure apps" 的访问可以解决此问题并报告。
https://myaccount.google.com/lesssecureapps (如果您登录了多个帐户,请不要忘记选择正确的帐户)。